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




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.