Home » C solved programs » C puzzles Programs

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" using if and else 
statement both.*/
 
#include <stdio.h>

int main() 
{ 

    if(!printf("Hello ")) 
        ; 
    else
        printf("C\n"); 

    return 0; 
}
    Hello C


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.