Skip to content
Home » C Program to Print Hello World Without Using Semicolon(printf and switch conditional statement)

C Program to Print Hello World Without Using Semicolon(printf and switch conditional statement)

Learn about C Program to Print Hello World Without Using Semicolon(printf and switch conditional statement) in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

We can use printf and the switch statement to create a C program that prints hello world without needing a semicolon. If the condition is met, the printf function displays the string “Hello World” and returns the number of characters in the string. However, because our task has been performed, we may close the switch statement with{}.

C Program to Print Hello World Without Using Semicolon(printf and switch conditional statement)

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

Output:

Hello World

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C Program to Print Hello World Without Using Semicolon( printf and while conditional statement)
C Program to Print Hello World Without Using Semicolon(puts and if conditional statement)