THE if-else STATEMENT Introduction When you want to take actions based on the outcome of the conditions, (true or false), then you can use the if-else statement.
Program/Example The general format for an if-else statement is
if (condition) simple or compound statement // s1 else simple or compound statement. // s2
If the condition is true then the s1 part is executed and if the condition is false then the s2 part is executed. For example,
if (a>b) printf (" big number is %d", a); // s1 else printf (" big number is %d", b); // s2
if a is greater than (b) then s1 is executed. Otherwise s2 is executed.
--------------------------------------------------------------------------------
|
| Author: Tejwant Singh Randhawa 16 Jun 2008 | Member Level: Silver Points : 1 |
when you want to make decision between true & false then we use if statement.
|