In this tutorial, We are going to learn about C Program to print “Hello World” without the semicolon(;)
We can print “Hello World” or anything else in the C program without using a semicolon. There are different ways to do the same:
1 Using if
2 Using switch
3 Using while loop
1: Using if
We take a simple C program to print “Hello World” using the if statement without using a semicolon(;)
1 2 3 4 5 6 |
#include<stdio.h> int main() { if(printf("Hello World")) return 0; } |
Output:
Hello World
2: Using the switch statement
we take an easy C program to print “Hello World” using a switch case statement without using a semicolon(;)
1 2 3 4 5 6 |
#include<stdio.h> int main() { switch(printf("Hello World")) return 0; } |
Output:
Hello World
3:Using while loop
We take an easy C program to print “Hello World” using while loop without using a semicolon(;)
1 2 3 4 5 6 |
#include<stdio.h> int main() { while(!printf("Hello World")) return 0; } |
Output:
Hello World
In this post, We learned about C Program to print “Hello World” without the semicolon(;)
You May Also Like:
Swapping of two numbers in C Language by using a temporary variable
Swapping two number using a bitwise operator in C language
Thank you for visiting.
If you have any feedback or suggestion please drop in below the comment box.