Test case 2 is not working in the problem for sum of digits

My logic is working on every input I enter , I have even used float datatype to make sure that it decimal digits also work , negative numbers are also working in my logic

#include
using namespace std;

int main() {
float n1, n2, n3;

cin >> n1 >> n2 >> n3;

if(n1 >= n2 && n1 >= n3)
    cout << "n1;

if(n2 >= n1 && n2 >= n3)
    cout << n2;

if(n3 >= n1 && n3 >= n2)
    cout << n3;

return 0;

}

hi @garvit510bhatia use else if for last 2 if conditions eg 2 5 5

1 Like

I hope I’ve cleared your doubt. 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.