From 3c20f41520aabad3e6a29e4fddeee60fc21f1b80 Mon Sep 17 00:00:00 2001 From: Shivani985 <47345178+Shivani985@users.noreply.github.com> Date: Tue, 29 Oct 2019 18:50:04 +0530 Subject: [PATCH] Create BubbleSort.c Add bubble sort --- Sorting Algorithm/BubbleSort.c | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Sorting Algorithm/BubbleSort.c diff --git a/Sorting Algorithm/BubbleSort.c b/Sorting Algorithm/BubbleSort.c new file mode 100644 index 0000000..2a2cd86 --- /dev/null +++ b/Sorting Algorithm/BubbleSort.c @@ -0,0 +1,39 @@ +#include +#include +void bubblesort(int a[],int size); +void main() +{ + int a[50],n,i; + printf("\n Enter the size of the array"); + scanf("%d",&n); + if(n>50) + { + printf("\n error"); + exit(0); + } + + printf("\n Enter the array elements: \n"); + + for(i=0;ia[j+1]) + { + temp=a[j]; + a[j]=a[j+1]; + a[j+1]=temp; + } + } + } +}