Print Hello World Without Semicolon C Program

C Program To Print Hello World Without Semicolon

Learn How To Print Hello World without Semicolon in C Programming Language. It is probably the very first C Program that every programmer begins with. This code demonstrates the legacy approach towards printing Hello World C Program in a new way.

Note: This C Program To Display Hello World without using a Semicolon is developed in Linux Ubuntu Operating System and compiled with GCC Compiler.

A general Hello World C Program includes a printf(); statement within the main function with a terminating Semicolon.

#include<stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}

The above code is just an example of the usual way of writing a Hello World Program. Now, let us see the new approach of writing it without using a semicolon at the end of the printf() statement. We have used a while loop within the main method. In a While Loop, you need not use a Semicolon to terminate the printf() statement.

Method 1: C Program To Print Hello World Without Semicolon using While Loop

#include<stdio.h>
void main()
{
while(!printf("Hello World\n"))
{
}
}

Method 2: Display Hello World without using Semicolon in C Programming using Switch Case

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

Method 3: C Code for Hello World without using Semicolon using If Block

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

Output

In case you have any compilation errors or doubts in this C Program To Print Hello World without Semicolon, let us know about it in the comment section below.