Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################

/.vs
28 changes: 28 additions & 0 deletions Sorting/Bubble Sort/bubbleSort.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include<stdio.h>
#include<conio.h>

public void BubbleSort()
{
int a[50], n, i, j, temp;
printf("Enter the size of array maximum size allowed is 50: ");
scanf("%d", &n);
printf("Enter the array elements: ");

for (i = 0; i < n; ++i)
scanf("%d", &a[i]);

for (i = 1; i < n; ++i)
for (j = 0; j < (n - i); ++j)
if (a[j] > a[j + 1])
{
temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}

printf("\nArray after sorting: ");
for (i = 0; i < n; ++i)
printf("%d ", a[i]);


}