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

application attempts to perform an operation?

2038


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

1604


Why c is a mother language?

1104


Is c call by value?

1083


How can you check to see whether a symbol is defined?

1146


Why c is faster than c++?

1095


What do you understand by friend-functions? How are they used?

1259


How can I do peek and poke in c?

1141


What are the types of pointers?

1194


can we have joblib in a proc ?

2394


Is null a keyword in c?

1256


how to capitalise first letter of each word in a given string?

1987


Write the syntax and purpose of a switch statement in C.

1154


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2697


What is Dynamic memory allocation in C? Name the dynamic allocation functions.

1486