Friday , 19 April 2024
Home » Tutorials » C programming » C program to implement Bubble sort

C program to implement Bubble sort


Bubble sort is a sorting technique where each two adjacent numbers are compared and the process is repeated until the whole list is sorted. This is less efficient but stable

Program:
#include
int main()
{
	int arr[100],i,j,n,temp;
	printf("Enter no. of terms\n");
	scanf("%d",&n);
	printf("Enter the elements\n");
	for(i=0;iarr[j+1])
			{
				temp=arr[j];
				arr[j]=arr[j+1];
				arr[j+1]=temp;
			}
		}
	printf("Sorted elements are\n");
	for(i=0;i

About Rajeel

I'm Rajeel, a teen blogger from India who loves computers, sports, internet and all other kind of tech stuffs. This blog thing is one of my favourite hobby and the one that eats up much of my time. But Really, I'm loving it :) Find me in G+

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Scroll To Top