0
What is the problem in this code
#include <iostream> using namespace std; int main() { int a,b,c; cout<<"enter three numbers:"; cin>>a>>b>>c; if (a>b&&a>c) cout<<"\n biggest number is "<<a; else if (b>a && a>c) cout<<"\n biggest number is"<<b; else cout<<"\n biggest number is "<<c; return 0; }
4 Respuestas
+ 3
Check for the following values of a, b and c
a = 2
b = 3
c = 2
Expected o/p = biggest number is 3
O/p generated by your program = biggest number is 2
+ 2
Working fine no problem
+ 2
It will fail for certain cases.
else if (b>a && b>c)
The above line should be changed to b>c as mentioned.
+ 1
Tnx