12.Write a program to print "Hello World" without using semicolon anywhere in the code.
Generally when we use printf("") statement, we have to use a semicolon at the end. If printf is used inside an if Condition, semicolon can be avoided.
Program: Program to print something without using semicolon (;)
#include
void main(){
//printf returns the length of string being printed
if (printf("H ello World\n")) //prints Hello World and returns 11
{
//do nothing
}
}
Output:
Hello World
Explanatio n:
The if statement checks for condition whether the return value of printf("He llo World") is greater than 0. printf
function returns the length of the string printed. Hence the statement if (printf("H ello World")) prints the string
"Hello World".
1 comments:
Write A Program To Print Hello World Without Using Semicolon Anywhere In The Code. ~ Crushhack >>>>> Download Now
>>>>> Download Full
Write A Program To Print Hello World Without Using Semicolon Anywhere In The Code. ~ Crushhack >>>>> Download LINK
>>>>> Download Now
Write A Program To Print Hello World Without Using Semicolon Anywhere In The Code. ~ Crushhack >>>>> Download Full
>>>>> Download LINK 9n
Post a Comment