Ascending order of array.

void main()
{
int a[100],a,i,j,temp;
clrscr();
printf("Enter the element of the array");
for(i=0;i
{
scanf("%d",&a[i])
}
for(i=0;i
{
for(j=(i++);j
{
if(a[i]>a[i])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
for(i=0;i
{
printf("%d",a[i]);
}
getch();
}

No comments:

Post a Comment