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

int main()
{
int a[20],n,i,j,temp;
printf("Enter the size of an array : ");
scanf("%d",&n);
printf("Enter the array elements : ");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=i;j<n;j++)
{
if(a[i]>a[j])
{
temp=a[j];
a[j]=a[i];
a[i]=temp;
}
}
}
printf("\nAscending Order\n");
for(i=0;i<n;i++)
{
printf("%d\n",a[i]);
}
return 0;
}

Is This Answer Correct ?    65 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?

1241


What is the difference between memcpy and memmove?

968


Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)

975


How can I get back to the interactive keyboard if stdin is redirected?

1133


to find the closest pair

2288


Explain the binary height balanced tree?

1123


Is flag a keyword in c?

1106


write a progrmm in c language take user interface generate table using for loop?

1994


What is c basic?

1123


Explain what is the difference between null and nul?

1081


Why we use int main and void main?

1016


the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b

2613


What is header file in c?

1019


Explain the use of 'auto' keyword

1071


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

958