What's the problem with this code? Question is->Life, the Universe, and Everything

void main()
int num;
cout<<""\n\tENter the number=;



Do not write anything other than output.

synatax error- cout<<""\n\tENter the number=;

Do not write “Enter the number” and also instead of void main use int main and return 0 in the last…

Syntax error; it should be, #include<iostream.h> or else it wont accept any input.
and also there should be cout<<"\n Enter the number?";

There are a lot of errors which are as follows :

  1. not used using namespace std in C++ program
  2. you dont have to use cout<<“Enter a naumber” and all on codechef
  3. At the end of program you should return 0 that indicate successful

Optimizing the solution

  1. Use for loop instead of while and do-while as they are faster.

  2. Use printf and scanf even in C++ to get input and output, as they are faster than cin and cout.

Happy coding…!!