Code:
void main()
{
if(CONDITION)
printf("Hello ");
else
printf("World");
}
You can't have a loop or other things in main()
According to my knowledge it's not possible.
But if it is possible, please let me know.
Thanks
|
Go4Expert Member
|
|
| 28Sep2007,18:17 | #1 |
|
Code:
void main()
{
if(CONDITION)
printf("Hello ");
else
printf("World");
}
You can't have a loop or other things in main() According to my knowledge it's not possible. But if it is possible, please let me know. Thanks |
|
Go4Expert Founder
|
![]() |
| 28Sep2007,18:24 | #2 |
|
printf("World"); would be nice option
|
|
Go4Expert Member
|
|
| 28Sep2007,18:28 | #3 |
|
thaks
|
|
Team Leader
|
![]() |
| 28Sep2007,19:49 | #4 |
|
A single if-else with a condition cannot take both branches. It's not an interesting question, it's a silly question.
|
|
Go4Expert Member
|
|
| 1Oct2007,17:26 | #5 |
|
condition --->if(!printf("hello"))
|
|
Go4Expert Member
|
|
| 1Oct2007,20:57 | #6 |
|
Well dawei......that is not a silly question......actually that's a tricky question......
|
|
Team Leader
|
![]() |
| 1Oct2007,21:54 | #7 |
|
Nothing tricky about it. It's silly. Your amazing solution only has one printf statement so it can't possibly
Quote:
Originally Posted by original poster |
|
Go4Expert Member
|
|
| 1Oct2007,22:01 | #8 |
|
DaWei....there are still two printf statements that get get executed.....one that prints hello and other that prints world.......so i think there is no problem in reading neither in comprehension.....
|