//Arrange in increasing order.
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],i,j,temp=0;
clrscr();
printf("Enter the 5 integer value of an array:");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<4;i++)
{
for(j=i;j<=4;j++)
{
if(a[i] < a[j+1])
{
temp=a[i];
a[i]=a[j+1];
a[j+1]=temp;
}
}
}
printf("After Arranging increasing order,array is:\n");
for(i=0;i<5;i++)
{
printf("%d\n",a[i]);
}
getch();
}
Output:
Enter the 5 integer value of an array:2332
3
5
6
After Arranging increasing order,array is:
32
23
6
5
3
No comments:
Post a Comment