#include <stdio.h>
#include <conio.h>
int main()
{
int s,temp,i,j,array[20];
printf("Enter total numbers of elements: ");
scanf("%d",&s);
printf("Enter %d elements: ",s);
for(i=0;i<s;i++)
{
scanf("%d",&array[i]);
}
for(i=s-2;i>=0;i--)
{
for(j=0;j<=i;j++)
{
if(array[j]>array[j+1])
{
temp=array[j];
array[j]=array[j+1];
array[j+1]=temp;
}
}
}
printf("After sorting: ");
for(i=0;i<s;i++)
{
printf(" %d",array[i]);
}
getch();
}
#include <conio.h>
int main()
{
int s,temp,i,j,array[20];
printf("Enter total numbers of elements: ");
scanf("%d",&s);
printf("Enter %d elements: ",s);
for(i=0;i<s;i++)
{
scanf("%d",&array[i]);
}
for(i=s-2;i>=0;i--)
{
for(j=0;j<=i;j++)
{
if(array[j]>array[j+1])
{
temp=array[j];
array[j]=array[j+1];
array[j+1]=temp;
}
}
}
printf("After sorting: ");
for(i=0;i<s;i++)
{
printf(" %d",array[i]);
}
getch();
}