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

#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;i++)
{
for(j=0;j<(n-1)-i;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
getch();
}

Is This Answer Correct ?    10 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to generate the Fibinocci Series

1157


Explain what is the purpose of "extern" keyword in a function declaration?

1025


What is the use of define in c?

998


Is c still relevant?

1034


how can use subset in c program and give more example

1925


Explain what are the different data types in c?

1157


while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above

1194


How to get string length of given string in c?

1008


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

1011


What is meant by operator precedence?

1095


Can a pointer be volatile in c?

930


How is = symbol different from == symbol in c programming?

983


How the c program is executed?

1075


Can you write a programmer for FACTORIAL using recursion?

984


What is array of structure in c programming?

1236