-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlatihan_kelima.cpp
More file actions
42 lines (37 loc) · 1.15 KB
/
Copy pathlatihan_kelima.cpp
File metadata and controls
42 lines (37 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
using namespace std;
int main()
{
double buku = 0;
float pinsil = 0;
int f = 0;
int x;
cout << "1. buku harga 1000 / buah" << endl;
cout << "2. pinsil harga 1500 / buah" << endl;
cout << "beli buku lebih dari 10 dapat diskon 10 persen dan pinsil 5 %" << endl;
cout << "masukkan pilihan = ";
cin >> x;
if (x== 1)
for (int i = 0; i<=20; i = i + 2)
{
if (i < 10){
cout << i << "buah" << "(" << i <<" buah x rp 1000 = " << i * 1000 << "=> Tidak kena Diskon" << endl;
}
else
{
cout << i << "buah" << "(" << i <<" buah x rp 1000) - (" << i <<" buah x rp 1000 * 0.10 " << (i * 1000) - (i * 1000 * 0.10) << "Rp" << endl;
}
}
if (x == 2)
for (int i = 0; i<=20; i = i + 2)
{
if (i < 10){
cout << i << "buah" << "(" << i <<" buah x rp 1000 = " << i * 1000 << "=> Tidak kena Diskon" << endl;
}
else
{
cout << i << "buah" << "(" << i <<" buah x rp 1000) - (" << i <<" buah x rp 1000 * 0.5 " << (i * 1000) - (i * 1000 * 0.5) << "Rp" << endl;
}
}
return 0;
}