+ 2

If statement if(???){ Printf("hello");}else{printf("world");} wht is the condition and output is :hello world

guess the condition

26th Oct 2016, 8:13 AM
Renganathan S
Renganathan S - avatar
6 Réponses
+ 1
I agree based on the condition only if statement can move either true part or else part . Here my branches question is which condition through we print both?? I hope now you can understand .
26th Oct 2016, 8:29 AM
Renganathan S
Renganathan S - avatar
+ 1
IF <always true cond.> goto ELSE ELSE {} There's no point in having an IF statement if both branches are executed.
26th Oct 2016, 8:39 AM
Mihai Benegui
Mihai Benegui - avatar
+ 1
goto is not condition ..... got it I need condition . anyway your answer right only .
26th Oct 2016, 8:41 AM
Renganathan S
Renganathan S - avatar
+ 1
is that even possible ??
26th Oct 2016, 10:16 AM
HARISH
HARISH - avatar
+ 1
yes sure possible one
26th Oct 2016, 10:24 AM
Renganathan S
Renganathan S - avatar
- 1
You cannot run both branches of the IF statement in your code. The syntax prevents you from doing so: IF <condition> /*Here it evaluates which branch to run. If the condition is met, it will run on Branch 1, otherwise on branch 2. It's either this or that.*/ {Execute Branch 1} ELSE {Execute Branch 2}
26th Oct 2016, 8:26 AM
Mihai Benegui
Mihai Benegui - avatar