Friday, July 5, 2019

Program C++ Memecah Uang dalam Rupiah | ALGORITMA PEMROGRAMAN

/***PROGRAM MEMECAH UANG***/
#include<iostream>
using namespace std;
int main() {
    /**DEKLARASI**/
    int x,ka,kb,kc,kd,ke,kf,kg,kh,ki,kj,sa,sb,sc,sd,se,sf,sg,sh,si,sj;
    /*ALGORITMA*/
    cout<<"PROGRAM MEMECAH UANG"<<endl;
    cout<<"Masukan sejumlah uang= Rp "; cin>>x;
    ka=x/100000;
    sa=x-ka*100000;
    kb=sa/50000;
    sb=sa-kb*50000;
    kc=sb/20000;
    sc=sb-kc*20000;
    kd=sc/10000;
    sd=sc-kd*10000;
    ke=sd/5000;
    se=sd-ke*5000;
    kf=se/2000;
    sf=se-kf*2000;
    kg=sf/1000;
    sg=sf-kg*1000;
    kh=sg/500;
    sh=sg-kh*500;
    ki=sh/200;
    si=sh-ki*200;
    kj=si/100;
    sj=si-kj*100;
    cout<<"Rp 100.000="<<ka<<endl;
    cout<<"Rp 50.000="<<kb<<endl;
    cout<<"Rp 20.000="<<kc<<endl;
    cout<<"Rp 10.000="<<kd<<endl;
    cout<<"Rp 5.000="<<ke<<endl;
    cout<<"Rp 2.000="<<kf<<endl;
    cout<<"Rp 1.000="<<kg<<endl;
    cout<<"Rp 500="<<kh<<endl;
    cout<<"Rp 200="<<ki<<endl;
    cout<<"Rp 100="<<kj<<endl;
    system("PAUSE");
   
}

No comments:

Post a Comment