0
Is there something wrong with my code???
#include <iostream> using namespace std; int main() { int x,m,n,max,min; cin>>x>>m>>n; if(x>m) max=x; if(n>max) max=n; else if(x<m) min=x; if(n<min) min=n; cout<<max<<endl; cout<<min<<endl; return 0; }
4 Réponses
+ 1
Before asking, Run it in the play ground. You will find it... If there is error, and if you cant rectify it then post here ...
And it works but need some changes.. Find out that first by yourself..
Changes needed in 2nd if and 2nd else expressions...
+ 1
Moe Faris
Not getting?
Look at this for Maximum finding...
cin>>x>>m>>n;
if(x>m && x>n)
max=x;
else if(m>n)
max=m;
else max=n;
cout<<max<<endl;
Now in same way find min....
if you still didnt get.. then look at thid code...
https://code.sololearn.com/cmeE9E57t6nz/?ref=app
0
the code works fine but the outputs are wrong
0
Nowhere you are assigning m value to max or min