From 4dbcaa1576c067143b6efcee83d68823065e0e43 Mon Sep 17 00:00:00 2001 From: utkarshchauhan007 <61346045+utkarshchauhan007@users.noreply.github.com> Date: Thu, 1 Oct 2020 22:24:49 +0530 Subject: [PATCH] Update bubble_sort.c --- bubble_sort.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bubble_sort.c b/bubble_sort.c index fa7952a..a04bf5b 100644 --- a/bubble_sort.c +++ b/bubble_sort.c @@ -4,7 +4,7 @@ int bubble(int n); int i,j,A[N]; int main() { - int jml; + int jml=0; printf("\t METODE BUBBLE SORT \n\n"); printf("Masukkan jumlah bilangan: "); scanf("%d",&jml); @@ -27,13 +27,13 @@ int main() // fungsi bubble int bubble(int n){ int temp; - for (i=1;i<=n-1;i++){ + for (i=1;iA[j]){ + if (A[i-1]>A[j]){ //swapping temp = A[i-1]; A[i-1] = A[j]; A[j] = temp; } } } -} \ No newline at end of file +}