The code is::::: if(condition)
Printf("Hello");
Else
Printf("World");
What will be the condition in if in such a way that both
Hello and world are printed in a single attempt?????? Single
Attempt in the sense... It must first print "Hello" and it
Must go to else part and print "World"..... No loops,
Recursion are allowed........................
Answer Posted / fazil
/* Solution 1: */
int main(int argc, char* argv[])
{
if( argc == 2 || main( 2, NULL ) )
{
printf("Hello ");
}
else
{
printf("World\n");
}
return 0;
}
/* Solution 2 (Only for Unix and Linux): */
int main(int argc, char* argv[])
{
if( !fork() )
{
printf("Hello ");
}
else
{
printf("World\n");
}
return 0;
}
| Is This Answer Correct ? | 4 Yes | 7 No |
Post New Answer View All Answers
What is an array? What the different types of arrays in c?
please send me the code for multiplying sparse matrix using c
What are the application of c?
What is scope rule in c?
What is the collection of communication lines and routers called?
What is a keyword?
Explain what is a pragma?
How do we print only part of a string in c?
What is identifiers in c with examples?
Explain built-in function?
program for reversing a selected line word by word when multiple lines are given without using strrev
Explain what is the difference between functions getch() and getche()?
How a string is stored in c?
What is context in c?
What tq means in chat?