Determine the if condition to print specific output

What should be the if condition in below code snippet, so that output would be “Hello World”.


Method 1: Using printf()


We can also use comma operator instead of depending upon the return value of printf in order to know what the conditional clause does.


Method 2: Recursive main()


Note that we can use write custom function instead of calling main() recursively –




Thanks for reading.

Please use ideone or C++ Shell or any other online compiler link to post code in comments.
Like us? Please spread the word and help us grow. Happy coding 🙂

Leave a Reply

Notify of