workshop problems

why online judge giving wrong answer???

#include<stdio.h>
int main(){
    int i,n,x=0;
    for(i=0;i<3;i++){
        scanf("%d", &n);
        if(x<n){
        x=n;}
    }
printf("%d\n", x);
return 0;
}

Which online judge? Which question? Atleast give some link mann.

1 Like


This is the link

You have not accounted the fact that there are multiple inputs. Make your program like this:

#include<stdio.h>
int main(){
    int a,b,c;
    while(cin >> a >> b >> c) {
        //Your logic here
    }
    return 0;
}
1 Like