if Statement

  

if Statement:

The if statement is the powerful decision making statement. It is used to check the condition and execute the statement. This statement execute the body of if, if and only if the condition the condition is true otherwise control goes to the next statement. This expression evaluate true or false.
The general syntax of if statement is 


Flowchart:



The body of if statement  may have one statement or group of statement where each statement is separate by semicolon.

For ex:



In the above example the user put the value of 'a' and 'b' then control check the condition i.e a>b. If 'a' is greater than 'b' then the value of 'a' will be print otherwise it will exit from statement. 

Comments