You are on page 1of 4

no3.

cpp > …
1 #include <iostream>
2
3 int main()
4 {
5 using namespace std;
6 int w, x, y, z;
7 cin >> w >> x >> y >> z;
8 if ((w + y)) * x > z)
9 {
10 cout << “HASIL LEBIH BESAR” << endl;
11 }
12 else
13 {
14 cout << “HASIL LEBIH KECIL” << endl;
15 }
16 return 0;
17 }

TERMINAL

E:\KODING>p
1
2
3
10
HASIL LEBIH KECIL

E:\KODING>p
1
2
3
1
HASIL LEBIH BESAR
no4.cpp > …
1 #include <iostream>
2
3 int main()
4 {
5 using namespace std;
6 int input;
7 float Phi = 3.14;
8 cin >> input;
9 if (input > 5)
10 {
11 int L = 6 * input;
12 cout << L << endl;
13 }
14 else
15 {
16 double L = (1 * Phi * input) / 4;
17 printf(“%f”, L);
18 }
19 return 0;
20 }

TERMINAL

E:\KODING>g++ no4.cpp –o p
no4.cpp:20:2: warning: no newline at end of file

E:\KODING>P
1
0.785000
E:\KODING>P
6
36
no1.cpp > …
1 #include <iostream>
2
3 int main()
4 {
5 using namespace std;
6 int angka1 = 35, angka2 = 76;
7 cout << (angka1 + angka2) * 10 << endl;
8 return 0;
9 }

TERMINAL

E:\KODING>g++ no1.cpp -o p
no1.cpp:9:2: warning: no newline at end of file

E:\KODING>P
1110

E:\KODING>
no2.cpp > …
1 #include <iostream>
2
3 int main()
4 {
5 using namespace std;
6
7 int input1, input2;
8 cin >> input1 >> input2;
9 int s2 = input1 + input2;
10 int L = 6 * s2;
11 if (L > 100)
12 {
13 cout << “SUDAH BAIK” << endl;
14 }
15 return 0;
16 }

TERMINAL

E:\KODING>g++ no2.cpp -o p
no2.cpp:16:2: warning: no newline at end of file

E:\KODING>P
10
11
SUDAH BAIK

E:\KODING>

You might also like