#include
#include
#define size 99
void sort(int[], int);
main(){
clrscr ();
int x[size],i,n,uang,hasil[size];
printf("Banyak Koin : ");
scanf("%d", &n);
printf("\nMasukkan Jenis Koin : ");
printf("\n");
for(i=1;i<=n;i++){
scanf("%d", &x[i]);
}
sort(x,n);
printf("\nKoin yang tersedia :");
printf("\n");
for(i=1;i<=n;i++){
printf("%d",x[i]);
printf("\n");
}
printf("\n");
printf("\nMasukkan nilai yang dipecah :");
scanf("%d", &uang);
printf("\n");
for(i=1;i<=n;i++){
hasil[i]=uang/x[i];
uang=uang%x[i];
}
for(i=1;i<=n;i++){
printf("keping %d",x[i]);
printf("-an sebanyak : %d",hasil[i]);
printf("\n \n");
}
getch();
return 0;
}
void sort (int a[],int siz){
int pass, hold, j;
for (pass=1; pass
hold=a[j+1];
a[j+1]=a[j+2];
a[j+2]=hold;}}}
OUTPUT
0 komentar:
Posting Komentar