Anda di halaman 1dari 1

#include<iostream.

h>
void main()
{
int harga;
int discount;
int total;
cout<<"------------------------------------------------------------------"<<endl;
cout<<"\t\tprogram menghitung total pembayaran \n\t\t\tsetelah diskon"<<
endl;
cout<<"-------------------------------------------------------------------"<<endl;
//input
cout<<"\tJumlah Pembelian\t=\tRp.\t";
cin>>harga;
if (harga>=100000)
{discount=0.1*harga;
cout<<"\t\tdiskon 10%\t=\tRp.\t";
cout<<discount<<endl<<endl;
//formula
total = harga - discount;
cout<<"\t\t\t\t\t------------------------ -"<<endl;
cout<<"\tTotal Pembayaran\t=\tRp.\t";
cout<<total<<endl;
}
else
{
discount=0.05*harga;
cout<<endl<<"\t\tDiskon 5%\t=\tRp.\t";
cout<<discount<<endl;
//formula
total=harga-discount;
cout<<"\t\t\t--------------------- - "<<endl;
cout<<"\tTotal Pembayaran\t=\t\tRp.\t";
cout<<total<<endl;
}
}