Skip to content

Instantly share code, notes, and snippets.

@gcs-abdulwahab
Created September 23, 2022 06:33
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 gcs-abdulwahab/f8c26227dd510c70fd7eba8f9353236b to your computer and use it in GitHub Desktop.
Save gcs-abdulwahab/f8c26227dd510c70fd7eba8f9353236b to your computer and use it in GitHub Desktop.
Finding Max using if and else if
if (a1>a2) {
if (a1 > a3) {
if (a1 > a4) {
if (a1 > a5) {
cout << a1 << " is maximum";
}
}
}
}
else if (a2 > a3){
if (a2>a4) {
if (a2 > a5) {
cout << a2 << " is maximum";
}
}
}
else if (a3 > a4){
if (a3>a5) {
cout << a3 << " is maximum";
}
}
else if (a4 > a5){
cout << a4 << " is maximum";
}
else{
cout<< a5 <<" is maximum ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment