C program to print message (Hello World/Hello C) without using any semicolon in program.

In this program, we will learn how to print any message without using semicolon (;) ?, as we all knows that we can print message using printf statement and printf statement terminates with semicolon.
Here is a trick to print message without terminating statement by semicolon (;) –

Call printf statement within the if condition and there is no need to terminate printf statement with semicolon (;) in if condition.

/*Program to print "Hello C" or any message 
without using any “;” in program*/ 

#include <stdio.h>
int main() 
    if(printf("Hello C\n")) 
    { } 

    Hello C

Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.

Comments and Discussions

We are using Google to publish ads on our website; Google has its own privacy policies. They may save log, cookies on your system. Google may also collect information of your system like IP address, region, city, country. For more details please go through the Google’s privacy policy.