In C, we can print anything without the use of a semicolon, including "hello" and "hello world". There are several methods to do this:
- Using if
- Using switch
- Using loop etc.
Program 1: Using if statement
#include<stdio.h>
int main()
{
if(printf("hello world")){}
return 0;
}
Output:
hello world
Program 2: Using switch statement
#include<stdio.h>
int main()
{
switch(printf("hello world")){}
return 0;
}
Output:
hello world
Program 3: Using while loop
#include<stdio.h>
int main()
{
while(!printf("hello world")){}
return 0;
}
Output:
hello world