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

how we can make 3d venturing graphics on outer interface

4832


What is the value of c?

1068


Why is sizeof () an operator and not a function?

1032


diff between exptected result and requirement?

2057


what is ur strangth & weekness

2432


what is the significance of static storage class specifier?

2263


how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

1089


What are the basic data types associated with c?

1271


How do you override a defined macro?

1273


Explain do array subscripts always start with zero?

1238


What is the difference between array and pointer?

1027


Is that possible to store 32768 in an int data type variable?

1080


Why is structure important for a child?

1104


Explain the use of keyword 'register' with respect to variables.

1052


Explain how can I read and write comma-delimited text?

1164