IF Statement
If the statement has an idea "if the condition is true, then the command will dikerjakana and if it does not qualify it will be ignored.
Ex program:
Case: specify the amount of pieces from the purchases of goods provided by a purchaser, with criteria:
1. there is no discount if the total purchases of less than 50,000
2. if the total purchases of more than or equal to 50,000 pieces received by 20% of total purchases.
From the above cases the program can be made as follows:
# include
# include
# include
Void main ()
{
Double tot_beli, bits = 0, jum_bayar = 0;
Court <<"total pemebelian USD. ";
Cin>> tot_beli;
If (tot_beli> = 50 000)
Pieces = 0.2 * tot_beli;
Court <<"size pieces USD. "<<
Jum_bayar = tot_beli - piece;
Court <<"amount to be paid Rp. ";
Court <
Getch ();
}
Tidak ada komentar:
Posting Komentar