Skip to content

Instantly share code, notes, and snippets.

@indramahkota
Created September 21, 2019 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indramahkota/4712b76452cc665748bb8f5103b853dd to your computer and use it in GitHub Desktop.
Save indramahkota/4712b76452cc665748bb8f5103b853dd to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
int a, b, c, d;
cout << "Masukkan nilai A: ";
cin >> a;
cout << "Masukkan nilai B: ";
cin >> b;
cout << "Masukkan nilai C: ";
cin >> c;
cout << "Masukkan nilai D: ";
cin >> d;
if(a > b && a > c && a > d) {
cout << "Angka terbesar adalah: " << a << endl;
} else if(b > a && b > c && b > d) {
cout << "Angka terbesar adalah: " << b << endl;
} else if(c > a && c > b && c > d) {
cout << "Angka terbesar adalah: " << c << endl;
} else {
cout << "Angka terbesar adalah: " << d << endl;
}
if(a < b && a < c && a < d) {
cout << "Angka terkecil adalah: " << a << endl;
} else if(b < a && b < c && b < d) {
cout << "Angka terkecil adalah: " << b << endl;
} else if(c < a && c < b && c < d) {
cout << "Angka terkecil adalah: " << c << endl;
} else {
cout << "Angka terkecil adalah: " << d << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment