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

#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]=t;
a[i]=a[j];
a[j]=t;
}
}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain why C language is procedural?

1226


Why we write conio h in c?

1039


Write the control statements in C language

1208


Why do we use c for the speed of light?

1214


What are the scope of static variables?

1195


how to execute a program using if else condition and the output should enter number and the number is odd only...

2303


What is the difference between text files and binary files?

1351


What is external variable in c?

1065


What is a header file?

1083


cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration

1110


What is extern keyword in c?

1136


Why clrscr is used after variable declaration?

1694


Explain what are multibyte characters?

1200


Why n++ execute faster than n+1 ?

3019


what are the different storage classes in c?

1184