. Mencari nilai tertinggi antara beberapa bilangan
1 | #include <iostream.h> |
2 | |
3 | int main () { |
4 | |
5 | double a,b,c; |
6 | cout << "Mencari Nilai Maximum \n\n"; |
7 | cout << "Masukkan tiga bilangan\n\n"; |
8 | cout << " Bilangan pertama = ";cin >> a; |
9 | cout << " Bilangan kedua = ";cin >> b; |
10 | cout << " Bilangan ketiga = ";cin >> c ; |
11 | |
12 | int max=a; |
13 | if (b > max) max =b; |
14 | if (c > max) max =c; |
15 | |
16 | cout <<"\n\nNilai maximum adalah " << max <<"\n\n"; |
17 | |
18 | system("PAUSE"); |
19 | return 0; |
20 | } |
Tidak ada komentar:
Posting Komentar