Rumus Diskon pada C++
#include <stdio.h>
main (){
float total, diskon = 0.0f;
printf("Total Belanja = Rp.");
scanf("%f", &total);
if(total >= 100000 && total<1000000)
diskon = total*0.05; // disc 5%
else if (total>=1000000)
diskon = total*0.2;
printf("jumlah yang harus dibayar : %8.2f\n", total - diskon);
}
main (){
float total, diskon = 0.0f;
printf("Total Belanja = Rp.");
scanf("%f", &total);
if(total >= 100000 && total<1000000)
diskon = total*0.05; // disc 5%
else if (total>=1000000)
diskon = total*0.2;
printf("jumlah yang harus dibayar : %8.2f\n", total - diskon);
}
Post a Comment