**c program for bubble sort.** Sorting refers to the operation of rearranging the element. Bubble sort algorithm requires **n-1 passes, where n is the number of input** items. Here is the c program for bubble sort. The **bubble sort** gets its name because elements tend to move up into the correct order like **bubbles rising to the surface.**

## c program for bubble sort

#include<stdio.h> #include<conio.h> int main( ) { int a[100]; int i, j, temp, n ; printf("how many numbers you want to sort : \n"); scanf("%d",&n); printf("Enter %d number values you want to sort\n", n); for(j=0; j<n; j++) scanf("%d",&a[j]); for(j=1;j<n;j++) { for(i=0; i<n; i++) { if(a[i]>a[i+1]) { temp=a[i]; a[i]=a[i+1]; a[i+1]=temp; } } } printf ( "\n\nArray after sorting:\n") ; for ( i = 0 ; i <n ; i++ ) printf ( "%d\t", a[i] ) ; getch(); }

### output of c program for bubble sort:

c program for bubble sort |

**Use of Bubble sort :**Bubble sort is simple and so it is often used to introduce the concept of sorting algorithm, to introductory computer science students.

its very well it giving nice problem

Thanks for the Program.Its very easy to remember…:)