Failed test case

My code failed to pass test 2…I unlocked the solution…the logic of that java code is the same as the code I wrote in cpp…Kindly help

hi @f20201011 your code is correct just initialize max with INT_MIN (in case all neg no your output will be 0)

#include<bits/stdc++.h>
using namespace std;
int main(){
    double n;
    double max=INT_MIN;
    for(int i=0;i<5;i++){
        cin>>n;
        if(n>max)
        max=n;
    }
    cout<<max;
}

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.