Output is wrong despite correct code?

I’m new to codechef and im doing the first problem life, the universe and everything but im getting wrong answers again and again. ive matched my answers with correct submissions as well but still its not accepting? My code is below.
#include
using namespace std;

int main() {
int n;
cin >> n;
while (n != 42) {
cout << n << endl;
cin >> n;
}

}

Since your return type for the main function is an int, it must return an integer.

#include
using namespace std;

int main() {
int n;
cin >> n;
while (n != 42) {
cout << n << endl;
cin >> n;
}
return 0;
}

returning 0 is not necessary at all
https://www.codechef.com/viewsolution/24127277

Since he didn’t submit any code which gave WA we would never know what mistake he did

@haroon97 i saw u got AC b4 @rahulbisht181 could ans. Its ur duty that u let people know that ur prob is solved. Otherwise nice people are wasting their time anwering ur ques

1 Like