Buble sorting juga,,
cuma bagian yang belom disort juga dipanggil, kalo yang pertama itu langsung diisikan.
#include<stdio.h>
#include<conio.h>
void main ()
{
clrscr();
int arr[10]={4,8,5,9,6,2,7,5,9,5};
int b,a,x,z;
printf ("\n PROGRAM BUBBLE SORTING \n");
printf("*---**----*--*----***-----****---*---**----*--*---**----*------*\n\n\n");
printf("Data Sebelum di-Sort\n");
printf("----------------------------------------------------\n");
for(b=0;b<10;b++)
{ printf(" [%d] ",arr[b]);}
for (a=0;a<=8;a++)
{
for (x=0;x<=8-a;x++)
{
if (arr[x]>arr[x+1])
{
z=arr[x];
arr[x]=arr[x+1];
arr[x+1]=z;
}
}
}
printf("\n\n\n\n\nData Setelah di-Sort\n");
printf("====================================================\n");
for (a=0;a<=9;a++)
{printf (" [%d] ", arr[a]);}
printf("\n====================================================\n\n\n\n");
printf(" Composed By :JAYARI/ 10540040\n");
printf(" Terimakasih>>>>>>>\n\n");
printf("Press Anykey to Exit!!");
getch();
}
makasihh jayy
ReplyDeletedah mau berbagi ilmu dengan kami
:D
tq gan
ReplyDelete