#include<stdio.h>
int bubblesort(int n)
{
int i , j , num , a[1000], temp , k;
num = n ;
printf(" \n Enter the array elements : - \t");
for(i=0; i<num ; i++)
{
scanf("%d",&a[i]);
}
k = num-1;
for(i =0; i<k ; i++)
{
for(j=0; j<num-i-1 ; j++)
{
if(a[j]> a[j+1])
{
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
}
}
printf(" \n\nThe Final Result after sorting is : - \t");
for(i=0;i<num ; i++)
{
printf("%d\t",a[i]);
}
return 0;
}
int main()
{
int n , x ;
printf(" Enter the number of elements : \t ");
scanf("%d",&n);
x=bubblesort(n);
return 0;
}
For
Other Programs Visit The WebSite:- https://www.techapurba.com/
Follow
Me On Social Media :-
Instagram
link :- https://www.instagram.com/apurba_khanra/
Twitter link : - https://twitter.com/ApurbaKhanra199
Facebook page link (Crazy Coders) :-https://www.facebook.com/codercrazy/?modal=admin_todo_tour
Facebook link :- https://www.facebook.com/profile.php?id=100009747586288
For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/
0 Comments