Write a program to print "Hello World" without using semicolon anywhere in the code inC?

Generally when we use printf("") statement, we have to use a semicolon at the end. If printf is used inside an if condition, semicolon can be avoided.

Program: Program to print some thing with out using semicolon(:wink:


int main() {

//printf returns the length of string being printed

if (printf("Hello World
")) //prints Hello World and returns 11


//do nothing


return 0;



Hello World


The if statement checks for condition whether the return value of printf(“Hello World”) is greater than

  1. Printf function returns the length of the string printed. Hence the statement if (printf(“Hello World”))

prints the string “Hello World”.