# C Program to print “Hello World!” without using a semicolon

CServer Side ProgrammingProgramming

Let us see how to write a C program in which we can print the text “Hello World” without using any semicolon.

We can simply write the text by using the line printf(“Hello World”); in the main() function.

But there is a semicolon at the end of the line. To avoid the semicolon, we can follow some trick. We can use the same printf() statement inside if condition. As the printf() statement returns the length of the text, so it is non zero value, so the if statement will be true. Thus the text will be written on screen.

## Example Code

#include<stdio.h>
main() {
if(printf("Hello World")) {
}
}

## Output

Hello World
Published on 15-Mar-2019 10:32:41