#include <stdio.h>
int main(){
int A[5]={15,30,24,12,4};
int i,j,temp;
printf("tampilkan angka: \n");
for(i=0;i<5;i++){
printf("A[%d]=%d \n", i+1, A[i]);
}
for(i=0;i<=3;i++){
for(j=i+1;j<=4;j++){
if(A[i]>A[j]){
temp=A[i];
A[i]=A[j];
A[j]=temp;
}
}
}
printf ("\n");
printf ("setelah diurutkan : \n");
for (i=0; i<5; i++){
printf (" A[%d] = %d \n",i+1, A[i]);
}
getch();
return 1;
}
int main(){
int A[5]={15,30,24,12,4};
int i,j,temp;
printf("tampilkan angka: \n");
for(i=0;i<5;i++){
printf("A[%d]=%d \n", i+1, A[i]);
}
for(i=0;i<=3;i++){
for(j=i+1;j<=4;j++){
if(A[i]>A[j]){
temp=A[i];
A[i]=A[j];
A[j]=temp;
}
}
}
printf ("\n");
printf ("setelah diurutkan : \n");
for (i=0; i<5; i++){
printf (" A[%d] = %d \n",i+1, A[i]);
}
getch();
return 1;
}
No comments:
Post a Comment