#include<conio.h>
void main()
{
clrscr();
float tot_beli, diskon, bayar;
cout<<"total pembelian : ";
cin>>tot_beli;
if(tot_beli > 1000000)
{
diskon = tot_beli * 0.2;
bayar = tot_beli - diskon;
}
else if(tot_beli > 500000)
{
diskon = tot_beli * 0.15;
bayar = tot_beli - diskon;
}
else if(tot_beli > 100000)
{
diskon = tot_beli * 0.1;
bayar = tot_beli - diskon;
}
else
{
cout<<"tidak ada diskon"<<endl;
diskon = tot_beli * 0;
bayar = tot_beli - diskon;
}
cout<<"diskon beli = "<<diskon<<endl;
cout<<"jumlah bayar = "<<bayar<<endl;
getch();
}
Hasilnya :
0 comments:
Post a Comment