C Program to print Hello World without semicolon

In this article, I will show you how you can write a C Program to print Hello World without semicolon. I will explain the algorithm, concepts and then help you to write C Program to print Hello World without semicolon.

1. Program Outline

In this C Program, we will see different methods to print Hello World without using semicolons. It can be asked in your Viva as a student and in an Interview if you’re looking for a Job.

2. Concepts

To write this C Program to print Hello World without semicolon, you need to learn the following concepts of C Programming:

  • For or While Loop
  • Conditional Statement
  • Macros
  • Switch Statement

3. Algorithm

To write this C program, follow this Algorithm:

4. Program

Here’s the C Program to print Hello World without semicolon:

Program 1: C Program to print Hello World without semicolon using switch Statement

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

Program 2: C Program to print Hello World without semicolon using While Loop

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

Program 3: C Program to print Hello World without semicolon using Macros

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

Program 4: C Program to print Hello World without semicolon using For loop

#include<stdio.h>  
 int main()    
{    
   for (;!(std::cout << "Hello World!");){}    
return 0;  
} 

Program 5: C Program to print Hello World without semicolon using If/else loop

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

5. Output

Here’s the output of the above C Program:

Hello World!
groot
groot

Leave a Reply

Your email address will not be published. Required fields are marked *