1// Aim: Program to perform Bubble Sort on an array.
2#include<stdio.h>
3void main(){
4 int a[30],n,s,i,j,temp;
5 printf("Enter the limit of the array :");
6 scanf("%d",&n);
7 printf("enter the elements of the array :");
8 for(i=0;i<n;i++){
9 scanf("%d",&a[i]);
10 }
11 for(i=0;i<n;i++){
12 for(j=i+1;j<n;j++){
13 if(a[i]>a[j]){
14 temp=a[i];
15 a[i]=a[j];
16 a[j]=temp;
17 }}}
18 printf("\n Sorted array :-");
19 for(i=0;i<n;i++){
20 printf("\t%d",a[i]);
21 }
22}
23