Please help

I m new to Codechef…but i m not able to get even one successful submition…my code is working fine ,in IDE i m using…but here it shows some or the other error…
even for the question (section:PRACTICE/EASY last question) :Life, the Universe, and Everything
why this code is not working…?c++(gcc-4.3.2)

#include<iostream>
using namespace std;
int main()
{
int num;
do
{
cin>>num;
if(num==42)
break;
else
cout<<num;
}while(1);
return 0;
}

this is your corrected code…!!!

#include<iostream>
using namespace std;
int main()
{
int num;
do
{
cin>>num;
if(num==42)
break;
else
cout<<num<<endl;
}while(1);
return 0;
}

you need to print a new line after every output…pls do read the output specifications carefully…hope this will help…:slight_smile:

The correct code for you is this:

#include<iostream>
using namespace std;
int main()
{
int num;
do
{
cin>>num;
if(num==42)
break;
else
cout<<num<<endl;
}while(1);
return 0;
}