answersLogoWhite

0

#include

#include

#include

#include

void main()

{

clrscr();

int n,i,term,j;

int x[100];

printf("/nEnter no. of terms (N) " );

scanf("%d",&n);

for(i=0;i

{

printf("n/Enter %d element",i+1);

scanf("%d", &x[i]);

}

printf("/given arrary is");

for(i=0;i

printf("/n %d",x[i]);

for(i=0;i

for(j=i+1;j

if(x[i]

{

term = x[i];

x[i] = x[j];

x[j] = term;

}

printf("/nSorted array is given below");

for(i=0;i

printf("/n%d",x[i]);

getch();

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

How can the keyword "sorting" be implemented in pseudo code to arrange the elements of an array a of integers in ascending order?

To implement the keyword "sorting" in pseudo code to arrange the elements of an array a of integers in ascending order, you can use the following algorithm: Start by iterating through the array a from the first element to the second-to-last element. Compare each element with the next element in the array. If the current element is greater than the next element, swap their positions. Continue this process until the entire array is sorted in ascending order. Here is a simple example of pseudo code for implementing the sorting algorithm: for i from 0 to length(a) - 1 do for j from 0 to length(a) - i - 1 do if aj aj 1 then swap(aj, aj 1) end if end for end for This pseudo code represents a basic implementation of a sorting algorithm to arrange the elements of an array in ascending order.


How do you read one dimensional array of integers for highest integer?

Sample code is as follows: #include <stdio.h> void main() { int i = 0; int final_number = 0; int array[] = {-2,-6,2,4,1,6,8,20,-55}; for(i = 0; i < (sizeof(array)/sizeof(array[0])); i++) { if(array[i] > array[i + 1]) final_number = array[i]; } printf("%d", final_number); } Tried in MinGw: Output: 20


How can one assign a list of integers in Java?

Put statements at the start of ones code will allow one to have a list of integers in their Java program. If one does this then they will successfully have integers in their code.


An array of array can be created in java?

Yes. int[][] as; // this will define an array of arrays of integers Multidimensional arrays, remember, are simply arrays of arrays. So a two-dimensional array of type int is really an object of type int array (int []), with each element in that array holding a reference to another int array. The second dimension holds the actual int primitives. The following code declares and constructs a two-dimensional array of type int: int[][] myArray = new int[3][]; Notice that only the first brackets are given a size. That's acceptable in Java, since the JVM needs to know only the size of the object assigned to the variable myArray.


Create a mark list using array with structure?

sorce code for student mark list usig array


What the code for ptca of left anterior descending coronary artery?

00.66 36.06


How do you sort the given contents of an array?

You would sort the given elements of an array by a bubble sort or heap sort code!!


What are the 4 an invalid BCD code?

BCD code isn't valid for these integers , 10 , 11 , 12 , 13 , 14 i.e if these integers ae converted to binary code they 'd be called wrong BCD


Can you help me with the C plus plus code of the program which has 10 index of array it adds 5 into every even elements of the array and then it subtracts 10 into the odd elements of the array?

int array[10] = {...}; for (int i = 0; i < 10; ++i) { if (i % 2 == 0) array[i] += 5; else array[i] -= 10; }


How 2 write c code of array data structure?

An example: int array [10]; yaaa this is write but for a simple programs on array and all data structure visit codingdatastructure.blogspot.com


How do you convert decimal to gray code?

In order to convert decimal to gray code use an array of int containing either a one or a zero at each position. A BitArray could also be used and might be a better choice.


What diagnosis code do you use with cpt code 63650?

CPT Code 63650 - Percutaneous implantation of neurostimulator electrode array, epidural