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 / rajesh evani

#include<stdio.h>
void main()
{
int a[5],t;
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++)
{
for (j=0;j<5;j++)
{
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
for(i=0;i<5;i++)
{
printf("%d",a[i]);
}
}

Is This Answer Correct ?    225 Yes 62 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In which layer of the network datastructure format change is done

1890


Explain how can I convert a string to a number?

1102


Explain what is page thrashing?

1101


How do you print only part of a string?

1023


Write program to remove duplicate in an array?

1083


What is the use of linkage in c language?

1067


What the different types of arrays in c?

1071


What is the use of c language in real life?

1027


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4690


What is identifiers in c with examples?

1182


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.

1942


Why is c called c?

1025


Explain the Difference between the New and Malloc keyword.

1141


What are register variables? What are the advantage of using register variables?

1191


Why is sizeof () an operator and not a function?

1032