Proses Iterasi




#include

void main()
{
int bil[10]={5,7,18,0,2,4,1,9,13,10};
int i,j,n=10,tamp,x;

for(i=0;i
printf("%i ",bil[i]);
printf("\n---------------------------------------\n");

for(i=0;i
{
printf("--iterasi ke-%i--\n",i+1);
for(j=n-1;j>=i+1;j--)
{
printf("cek bil[%i] ",j,j-1);
if(bil[j]
{
tamp=bil[j];
bil[j]=bil[j-1];
bil[j-1]=tamp;
printf("(terjadi pertukaran)");
}
for(x=0;x
printf("%i ",bil[x]);
printf("\n");
}
printf("\n");
}
}

0 comments:

Post a Comment