Skip to content

Instantly share code, notes, and snippets.

@edenizk
Created May 11, 2018 16:56
Show Gist options
  • Select an option

  • Save edenizk/efa7eb48e743b6a10794e71544b29d04 to your computer and use it in GitHub Desktop.

Select an option

Save edenizk/efa7eb48e743b6a10794e71544b29d04 to your computer and use it in GitHub Desktop.
finds the max value
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int a, b, c;
cout<<"write 3 value"<<endl;
cin>>a>>b>>c;
if (a>=b && b>=c){
cout<<a<<">"<<b<<">"<<c;
}
else if(b>=a && a>=c){
cout<<b<<">"<<a<<">"<<c;
}
else if(a>=c &&c>=b){
cout<<a<<">"<<c<<">"<<b;
}
else if(b>=c && c>=a){
cout<<b<<">"<<c<<">"<<a;
}
else if(c>=b && b>=a){
cout<<c<<">"<<b<<">"<<a;
}
else if(c>=b && a>=b){
cout<<c<<">"<<a<<">"<<b;
}
else if (c>=a&&a>=b){
cout<<c<<">"<<a<<">"<<b;
}
return 0;
}
/* a>b a>c
b>a b>c
c>a c>b
b>c>a
c>a>b
c>b>a*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment