Write a program to sort the elements of an array in descending order.
# include
# include
void main()
{
int a[20],n,i,j,t;
clrscr();
printf("Enter the number of elements in an array:");
scanf("%d",&n);
for(i=0;i
printf("\nEnter the %d value:",i+1);
scanf("%d",&a[i]);
}
for(i=0;i
for(j=i;j
if(a[i] {
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
for(i=0;i
getch();
}
/* Output
Enter the number of elements in an array:3
Enter the 1 value:6
Enter the 2 value:5
Enter the 3 value:8
8
6
5
*/
Shopping In MUMBAI
Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top.
Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.
Tuesday, December 30, 2008
C program to sort the elements of an array in descending order.
Posted by ars at 12:12 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment