The ones who are crazy enough to think they can change the world are the ones who do.- Steve Jobs
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.
Here we use if statement to print "Hello world" without using semicolon.
#include <stdio.h>
int main()
{
if(printf("Hello world "))
{
}
return 0;
}
Hello world
Here we use if statement to print "Hello world" without using semicolon.
#include <stdio.h>
int main()
{
if(printf("Hello world "))
{
}
return 0;
}
Hello world
Here we use while loop to print "Hello world" without using semicolon.
#include <stdio.h>
int main()
{
while(printf("Hello world"))
{
break;
}
return 0;
}
Hello world
Here we use same while loop with not condition to print "Hello world" without using semicolon.
#include <stdio.h>
int main()
{
while(! printf("Hello world"))
{
}
return 0;
}
Hello world
Here we use switch statement to print "Hello world" without using semicolon.
#include <stdio.h>
int main()
{
switch(printf("Hello world"))
{
}
return 0;
}
Hello world
Here we use else if statement to print "Hello world" without using semicolon.
#include <stdio.h>
int main()
{
if(0)
{
}
else if(printf("Hello world "))
{
}
return 0;
}
Hello world
We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.
© Copyright 2019