From 7f4d033048ea42c0130e3a3296c43cdebacca849 Mon Sep 17 00:00:00 2001 From: DareDevilStudios <81734540+DareDevilStudios@users.noreply.github.com> Date: Fri, 1 Oct 2021 22:01:44 +0530 Subject: [PATCH] Create bubble-sort.c bubble sort program in c --- arrays/sorting/bubble-sort/bubble-sort.c | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 arrays/sorting/bubble-sort/bubble-sort.c diff --git a/arrays/sorting/bubble-sort/bubble-sort.c b/arrays/sorting/bubble-sort/bubble-sort.c new file mode 100644 index 0000000..855a103 --- /dev/null +++ b/arrays/sorting/bubble-sort/bubble-sort.c @@ -0,0 +1,25 @@ +#include +void main() +{ + int n,arr[50],temp,i,j; + printf("\n\n\t\t\t\t Bubble Sort\n--------------------------------------------------------------------------------\n"); + printf("\n\n Enter the limit : "); + scanf("%d", &n); + printf("\n Enter the elements to the array \n\n"); + for (i=0;i arr[j+1]){ + temp = arr[j]; + arr[j] = arr[j+1]; + arr[j+1] = temp; + } + } + printf("\n\t\t\t\t Sorted Array\n--------------------------------------------------------------------------------\n"); + for (i=0;i