if-else statement

  

if-else statement:

 The if-else statement is an extension of the simple if statement.In this statement body of if statement is executed if condition is true otherwise body of else statement is executed.In this statement  either body of if  or body of else is executed  and then only the control moves to the next statement.
The general syntax of if-else statement is

Flowchart:


Ex:


In the above example if value of 'a' is greater than 'b' then value of 'a' is the output otherwise value of 'b' is the output. 


Comments