C program to print Hello world

hello world

C program to print Hello world without using semicolon

Firstly, you need Turbo C++ in your machine for run any C and C++ program. If you have not Turbo C++ in your system don’t worry you can download Turbo C++ from here and run this program very easily.

We can print “Hello world” or anything else in C without using a semicolon. There are various ways to do so:

1: Using if statement
2: Using switch statement
3: Using while-loop
4: Using macros

Program 1: Using if statement

Print “hello world” using if statement without using a semicolon.

#include<stdio.h> 
#include<conio.h> 
 void main()    
{clrscr();
 printf("\n\t\t\t...Welcome To EduNews.Tech... ");
 if(printf("\n\nHello world")){}    
printf("\n\n\n\n\t\t\tThankyou for Joining Us !");
    printf("\n\t\t\t!Regards EduNews !");
//return 0;
getch();  
}

Program Output:

Program 2: Using switch statement

Print “hello world” using switch statement and without using semicolon.

#include<stdio.h>  
#include<conio.h>

 void main()    
{    
printf("\n\t\t\t...Welcome To EduNews.Tech... ");
printf(“…Welcome To EduNews…”);
switch(printf("\n\nHello world")){}    
  printf("\n\n\n\n\t\t\tThankyou for Joining Us !");
    printf("\n\t\t\t!Regards EduNews !");
getch();
}

Program Output:

Program 3: Using while loop

Print “hello world” using while loop and without using semicolon.

#include<stdio.h> 
#include<conio.h>
 
 void main()    
{    
printf(“\t\t\t…Welcome To EduNews.Tech…”);
   while(!printf("Hello world")){}    
printf("\n\n\n\n\t\t\tThankyou for Joining Us !");
    printf("\n\t\t\t!Regards EduNews !");
getch();
}   

Program Output:

Program 4: Using macros

Print “hello world” using macros and without using a semicolon.

#include <stdio.h> 
#include<conio.h>

#define EduNews printf("Hello World") 
void main() 
{ 
printf("\n\t\t\t...Welcome To EduNews.Tech... ");
    if (EduNews) 
    { 
    } 
printf("\n\n\n\n\t\t\tThankyou for Joining Us !");
    printf("\n\t\t\t!Regards EduNews !");
getch()
}

Program Output:

Output for above all mentioned methods are the same-

Hello World

 

I hope this post helps you to understand Hello World and its implementation in C programming language.
Keep coding 🙂

4 thoughts on “C program to print Hello world”

Leave a Reply

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