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

What are local variables c?

1009


What is strcmp in c?

1114


Write a program in c to replace any vowel in a string with z?

1118


Are the outer parentheses in return statements really optional?

1111


Is calloc better than malloc?

1011


What is wild pointer in c with example?

1056


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

1270


Where is volatile variable stored?

1084


What is the code in while loop that returns the output of given code?

1977


What is a char in c?

991


Where is c used?

1092


How many data structures are there in c?

1112


What does the characters “r” and “w” mean when writing programs that will make use of files?

1472


What is the general form of function in c?

1020


What are the similarities between c and c++?

1064