#include<stdio.h>
#include<conio.h>
void
main()
{
clrscr();
int a[25],i,n,j,temp;
printf("Enter the size of array
a:-\n");
scanf("%d",&n);
printf("Enter element into array
a:-\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
printf("The ascending order is
:-\n");
for(i=0;i<n;i++)
{
printf("%d\t",a[i]);
}
getch();
}
No comments:
Post a Comment