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 / bhagya

#include<stdio.h>
#include<conio.h>
void main()
{
int a[5];
int i,j=0;
printf("enter 5 values into the array a");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
printf("the sorted order of elements");
for(i=0;i<5;i++)
{ t=a[i];
for(j=0;j<5;j++)
{
if(a[i]>a[j])
a[i]=a[j];
a[j]=t;
}
}
}

Is This Answer Correct ?    144 Yes 123 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is struct node in c?

1021


Explain how do you list files in a directory?

1017


What is define c?

1001


Which is better between malloc and calloc?

1120


In a header file whether functions are declared or defined?

1078


int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above

1222


Are comments included during the compilation stage and placed in the EXE file as well?

1029


main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above

1043


Why & is used in c?

1118


What is chain pointer in c?

1008


Why calloc is better than malloc?

973


How a string is stored in c?

1017


What's the difference between constant char *p and char * constant p?

1089


what is the basis for selection of arrays or pointers as data structure in a program

4250


What is linear search?

1088