Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What does malloc () calloc () realloc () free () do?

1060


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

1161


What is the difference between far and near ?

1190


What does it mean when the linker says that _end is undefined?

1087


What is a function in c?

1571


What is difference between far and near pointers?

1034


How can I split up a string into whitespace-separated fields?

1052


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

1058


How do you convert strings to numbers in C?

1218


What is the advantage of an array over individual variables?

1226


What is null pointer constant?

1148


How can I send mail from within a c program?

1024


Difference between MAC vs. IP Addressing

1145


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.

3962


Hi can anyone tell what is a start up code?

2060