write a program to sort the elements in a given array in c
language
Answer Posted / rakesh kumar
#include<stdio.h>
#include<conio.h>
#define MAX 10
void main()
{
int list[MAX],i,j,temp;
printf("input a 10 numbers");
for(i=0;i<MAX;i++)
{
scanf("%d",&list[i]);
}
for(i=0;i<MAX;i++)
{
for(j=i+1;j<MAX-1;j++)
{
if(list[i]>list[j])
temp=list[j];
list[j]=list[i];
list[j]=temp;
}
}
printf("Sort the number assending order");
for(i=0;i<MAX;i++)
{
printf("%d",list[i]);
}
getch();
}
| Is This Answer Correct ? | 8 Yes | 9 No |
Post New Answer View All Answers
What does malloc () calloc () realloc () free () do?
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
What is the difference between far and near ?
What does it mean when the linker says that _end is undefined?
What is a function in c?
What is difference between far and near pointers?
How can I split up a string into whitespace-separated fields?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
How do you convert strings to numbers in C?
What is the advantage of an array over individual variables?
What is null pointer constant?
How can I send mail from within a c program?
Difference between MAC vs. IP Addressing
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
Hi can anyone tell what is a start up code?