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; }

29th Nov 2019, 3:37 PM
Moe Faris
Moe Faris - avatar
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...
29th Nov 2019, 4:06 PM
Jayakrishna 🇮🇳
+ 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
29th Nov 2019, 7:08 PM
Jayakrishna 🇮🇳
0
the code works fine but the outputs are wrong
29th Nov 2019, 4:08 PM
Moe Faris
Moe Faris - avatar
0
Nowhere you are assigning m value to max or min
29th Nov 2019, 5:00 PM
Prasanth