#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
long int uang,kembali,total,sisa1,sisa2,sisa3,sisa4,sisa5,sisa6,sisa7,sisa8;
printf("Uang Anda :");
scanf("%li",&kembali);
printf("Total Belanja :");
scanf("%li",&total);
uang = kembali-total;
printf("Kembalian :%li\n",uang);
printf("\n<< Rincian Kembalian >>\n");
printf("===================================\n");
sisa1=uang/100000;
if(sisa1>0)
uang=uang%100000;
sisa2=uang/50000;
if(sisa2>0)
uang=uang%50000;
sisa3=uang/20000;
if(sisa3>0)
uang=uang%20000;
sisa4=uang/10000;
if(sisa4>0)
uang=uang%10000;
sisa5=uang/5000;
if(sisa5>0)
uang=uang%5000;
sisa6=uang/2000;
if(sisa6>0)
uang=uang%2000;
sisa7=uang/1000;
if(sisa7>0)
uang=uang%1000;
sisa8=uang/500;
if(sisa8>0)
uang=uang%500;
printf("Pecahan Rp. 100000 : %li lembar\n",sisa1);
printf("Pecahan Rp. 50000 : %li lembar\n",sisa2);
printf("Pecahan Rp. 20000 : %li lembar\n",sisa3);
printf("Pecahan Rp. 10000 : %li lembar\n",sisa4);
printf("Pecahan Rp. 5000 : %li lembar\n",sisa5);
printf("Pecahan Rp. 2000 : %li lembar\n",sisa6);
printf("Pecahan Rp. 1000 : %li lembar\n",sisa7);
printf("Pecahan Rp. 500 : %li koin\n",sisa8);
printf("__________________________________\n");
printf("sisa uang : %li Rupiah\n",uang);
printf("==================================\n\n\n");
printf("<< Terima Kasih >>\n\n");
printf("Created By : Heru Dwi Siswoyo");
getch();
}
Minggu, 04 Juni 2017
Home »
» Program Mencari Pecahan Uang Menggunakan IF Pada C++
0 komentar:
Posting Komentar