//WAP TO SORT THE GIVEN ELEMENTS BY USING BUBBLE SORT



Image result for VERY BEAUTIFUL PIC

BUBBLE SORT

#include<stdio.h>
#include<conio.h>
void main()
{
int a[50],n,i,j,temp;
printf("enter the size of array:");
scanf("%d",&n);
printf("enter the array elements:");
for(I=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(I=1;i<n;i++)
{
for(j=0;j<(n-1);j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
printf("\n array after sorting");
for(I=0;i<n;i++)
{
printf("%d",a[i]);
}
}





Image result for VERY BEAUTIFUL PICImage result for VERY BEAUTIFUL PIC


run this program

Comments

Post a Comment

Popular posts from this blog

Trading Live Advance Chart Source code HTML CSS & JS

How to show live Cryptocurrency Price In your website Using HTML CSS, AND JavaScript

Learn Python 2024 by gaurav tripathi