PROGRAM:
#include<stdio.h>
main()
{
int A[20],n,i,j,temp;
clrscr();
printf("Enter the size of
array:\n");
scanf("%d",&n);
printf("Enter the array
elements:\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 sorted arrays are as
follows:\n");
for(i=0;i<n;i++)
printf("%d\t",A[i]);
getch();
}
OUTPUT:
Enter the size of array:
6
Enter the array elements:
11
45
69
72
36
45
The sorted arrays are as follows:
0
11 36 45
69 72
Enter the size of array:
6
Enter the array elements:
-8
9
69
36
89
10
The sorted arrays are as follows:
-8 0
9 10 36
69
Thank Your Valuable Comment Tool to Insert codes in Comments : Convert My Code. Hide