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 does the message "automatic aggregate intialization is an ansi feature" mean?
What is #line?
What are actual arguments?
to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?
How do you do dynamic memory allocation in C applications?
Tell us bitwise shift operators?
Explain how do you search data in a data file using random access method?
if p is a string contained in a string?
What is scope of variable in c?
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
How can I sort a linked list?
What is the auto keyword good for?
Multiply an Integer Number by 2 Without Using Multiplication Operator
Differentiate between new and malloc(), delete and free() ?
What are the salient features of c languages?