The ones who are crazy enough to think they can change the world are the ones who do.
- Steve Jobs

C Print a string without using Semicolons

string Without using semicolon

Here your task is to print any string without using semicolon. We need 5 possible ways of printing any string without using semicolon from you, the programmer.

C Program - String without using Semicolon

Here we use if statement to print "Hello world" without using semicolon.

c-without-semicolon-1.c
#include <stdio.h>
int main()
{
if(printf("Hello world "))
{
}
return 0;
}
Hello world

C Program - String without using Semicolon - 1

Here we use if statement to print "Hello world" without using semicolon.

c-without-semicolon-if.c
#include <stdio.h>
int main()
{
if(printf("Hello world "))
{
}
return 0;
}
Hello world

C Program - String without using Semicolon - 2

Here we use while loop to print "Hello world" without using semicolon.

c-without-semicolon-while.c
#include <stdio.h>
int main()
{
while(printf("Hello world"))
{
break;
}
return 0;
}
Hello world

C Program - String without using Semicolon - 3

Here we use same while loop with not condition to print "Hello world" without using semicolon.

c-without-semicolon-while-1.c
#include <stdio.h>
int main()
{
while(! printf("Hello world"))
{
}
return 0;
}
Hello world

C Program - String without using Semicolon - 4

Here we use switch statement to print "Hello world" without using semicolon.

c-without-semicolon-switch.c
#include <stdio.h>
int main()
{
switch(printf("Hello world"))
{
}
return 0;
}
Hello world

C Program - String without using Semicolon - 4

Here we use else if statement to print "Hello world" without using semicolon.

c-without-semicolon-else-if.c
#include <stdio.h>
int main()
{
if(0)
{
}
else if(printf("Hello world "))
{
}
return 0;
}
Hello world

Report Us

We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.

Report