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 arrange the contents of a 1D array in
ascending order

Answer Posted / prakashmca

#include<stdio.h>
#include<conio.h>
void main()
{
int a[20],n,i,j,temp;
clrscr();
printf("\n enter the size of the array");
scanf("%d",&n);
printf("\n enter the contents of the array");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n-1;i++)
{
for(j=0;j<n;j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
getch();
}

Is This Answer Correct ?    7 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which of these functions is safer to use : fgets(), gets()? Why?

1094


Explain what does the function toupper() do?

1071


why do some people write if(0 == x) instead of if(x == 0)?

1068


Hai what is the different types of versions and their differences

1939


How can I access an I o board directly?

1089


What is the use of static variable in c?

1089


What does printf does?

1242


What are different types of variables in c?

1063


Can variables be declared anywhere in c?

1085


What is boolean in c?

1088


What is formal argument?

1129


Is c++ based on c?

1070


How to find a missed value, if you want to store 100 values in a 99 sized array?

1407


Explain how do you generate random numbers in c?

1082


What is the auto keyword good for?

1144