Menghitung nilai discount menggunakan if.
#include <stdio.h>
main()
{
double total_pembelian, discount = 0;
printf("Total pembelian = Rp ");
scanf("%lf", &total_pembelian);
if(total_pembelian >= 100.000)
discount = 0.05 * total_pembelian;
printf("Besarnya discount = Rp %.2lf\n", discount);
}
............SEMOGA BERHASIL......
#include <stdio.h>
main()
{
double total_pembelian, discount = 0;
printf("Total pembelian = Rp ");
scanf("%lf", &total_pembelian);
if(total_pembelian >= 100.000)
discount = 0.05 * total_pembelian;
printf("Besarnya discount = Rp %.2lf\n", discount);
}
............SEMOGA BERHASIL......