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
Is struct oop?
What is the difference between memcpy and memmove?
What is header file definition?
How many types of functions are there in c?
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none
Explain is it valid to address one element beyond the end of an array?
Why header file is used in c?
Is a pointer a kind of array?
What will be your course of action for a push operation?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
Write a program of advanced Fibonacci series.
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
Difference between Function to pointer and pointer to function
Write a C program in Fibonacci series.
Explain pointer. What are function pointers in C?