how did i answer wrong for test case 2 my code gives soln for -ve numbers also
Test Case 2 largest 3 numbers
you miss the case when 2 numbers are equal
your code fail for this testcase
5 5 2
you Code Output will be 2
but correct output is 5
Modification : only modify the if condition
#include<iostream>
using namespace std;
int main(){
int a;
int b;
int c;
cin>>a;
cin>>b;
cin>>c;
if (a>=b && a>=c){
cout<<a<<endl;
}
else if (b>=a && b>=c){
cout<<b<<endl;
}
else {
cout<<c<<endl;
}
return 0;
}
I hope I’ve cleared your doubt.
if not feel free to ask
otherwise I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.