![/*C-program to write array elements in ascending order.*/
#include<stdio.h>
#include<conio.h>
main()
{
int a[10],i,j,k;
clrscr();
printf(]([IMAGEURL])
a[j])
{
k=a[i];
a[i]=a[j];
a[j]=k;
}
}
}
printf("Array element is in ascending order.");
for(i=0;i<10;i++)
{
printf("%dt",a[i]);
}
getch();
}
/*output*/
Enter the array elements:434 45 465 13 67 83 ">
/*C-program to write array elements in ascending order.*/
#include
#include
main()
{
int a[10],i,j,k;
clrscr();
printf("Enter the array elements:");
for(i=0;i<10;i++)
{
scanf("%dt",&a[i]);
}
for(i=0;i<9;i++) /*write array elements in ascending
order*/
{
for(j=i+1;j<10;j++)
{
if(a[i]>a[j])
{
k=a[i];
a[i]=a[j];
a[j]=k;
}
}
}
printf("Array element is in ascending order.");
for(i=0;i<10;i++)
{
printf("%dt",a[i]);
}
getch();
}
/*output*/
Enter the array elements:434 45 465 13 67 83