From 6c337279df34fc428f2c4749d032d317111eccac Mon Sep 17 00:00:00 2001 From: bankuri1 <65163703+bankuri1@users.noreply.github.com> Date: Thu, 14 Oct 2021 18:13:31 +0530 Subject: [PATCH] Created bubble_sort.c Bubble sort implementation in c programming language --- bubble_sort.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 bubble_sort.c diff --git a/bubble_sort.c b/bubble_sort.c new file mode 100644 index 0000000..e21c9c1 --- /dev/null +++ b/bubble_sort.c @@ -0,0 +1,31 @@ +#include + +int main(){ + + int count, temp, i, j, number[30]; + + printf("How many numbers are u going to enter?: "); + scanf("%d",&count); + + printf("Enter %d numbers: ",count); + + for(i=0;i=0;i--){ + for(j=0;j<=i;j++){ + if(number[j]>number[j+1]){ + temp=number[j]; + number[j]=number[j+1]; + number[j+1]=temp; + } + } + } + + printf("Sorted elements: "); + for(i=0;i