C Programming

Bubble Sort Program in C

Top 5 programming language in 2020
Written by Arpit

How Learner , Today we will See how to make a Bubble Sort Array Program in C.

 

Below is the Code for the Program.

 

#include<stdio.h>
void main()
{
    int a[5],i,j,b;

    printf(“enter five digits : \n”);
   for(i=0;i<5;i++)
   scanf(“%d”,&a[i]);

   for(i=0;i<5;i++)
   {
       for(j=0;j<4-i;j++)
       {
         if(a[j]>a[j+1])
         {
          b=a[j];
          a[j]=a[j+1];
          a[j+1]=b;
         }
      }
   }
   printf(“sorted array is \n :”);
   for(i=0;i<5;i++)
   printf(“sorted array is \n %d \n”,a[i]);

}

I hope the Above code is beneficial for all of you.

Happy Coding , Keep Coding

 

About the author

Arpit

1 Comment

  • I would like to thnkx for the efforts you have put in writing this site. I’m hoping the same high-grade site post from you in the upcoming also. Actually your creative writing abilities has encouraged me to get my own blog now. Actually the blogging is spreading its wings fast. Your write up is a good example of it.

Leave a Comment