Click here to Skip to main content
15,914,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
what should i write in if block such tha if part is executed and also else part is executed.
if(?)
bombay
else
calcutta
i want bombay calcutta both as output
Posted

This is a stupid trick question. Google[^] for answers
 
Share this answer
 
Perhaps you should buy a basic C book ( why on earth are you learning C ? Not even C++, or C# ? ), and work through it ?
 
Share this answer
 
You don't. The point of the else clause is that it is only executed when the if clause is not.

However, have you considered just following an if with sequential code?

if ( ... )
{
   sometimes_do_this();
}
always_do_this();
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900