Pembulatan Uang Kedalam Pecahan Terendah
Posted by Budi Arieyanto | Posted in Borlant C++ | Posted on 05.12
#include<iostream.h>
#include<conio.h>
void main()
{
long int uang,pecahan,temp1,temp2,temp3,temp4,temp5,sisa,ribuan,lima_ratusan,ratusan,lima_puluhan,dua_limaan;
cout<<"Nilai Belanja : Rp.";cin>>uang;
ribuan = uang / 1000;
temp1 = uang % 1000;
lima_ratusan = temp1 / 500;
temp2 = temp1 % 500;
ratusan = temp2 / 100;
temp3 = temp2 % 100;
lima_puluhan = temp3 / 50;
temp4 = temp3 % 50;
dua_limaan = temp4 / 25;
temp5 = temp4 % 10;
sisa = temp5 % 10;
pecahan=uang-temp4;
cout<<"========================"<<endl;
cout<<"Hasil Bulatan Dari Nilai Uang Ke Pecahan Terendah = "<<pecahan<<",-"<<endl;
getch();
}


Comments (0)
Posting Komentar