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

#include<stdio.h>
#include<conio.h>
main()
{
int temp,i,j,n=10;
int arr[n];
clrscr();
printf("\n\tEnter The Values into array");
for(i=0;i<n;i++){
printf("\n Enter Element no %d: ",i);
scanf("%d",&arr[i]);}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(arr[j] > arr[j+1]){
temp=arr[j];
arr[j]=arr[j+1];
arr[j]=temp;}
}}
printf("\n-- Sorted Series --");
for(i=0;i<n;i++){
printf("\t %d",arr[i]);}
getch();
}

Is This Answer Correct ?    16 Yes 27 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

1145


Tell me what is the purpose of 'register' keyword in c language?

1012


Why does everyone say not to use scanf? What should I use instead?

1422


Is null a keyword in c?

1197


What are the string functions? List some string functions available in c.

991


Differentiate between the expression “++a” and “a++”?

1253


When can a far pointer be used?

1027


Explain built-in function?

1138


What are conditional operators in C?

1100


What is gets() function?

1132


How do we print only part of a string in c?

1029


What does. int *x[](); means ?

1070


Differentiate fundamental data types and derived data types in C.

1036


When should a type cast be used?

1018


Why is c called c?

1025