if else statement
When an if condition is true then the statements in if section are executed. When the condition is evaluated to false the statements in the else section will be executed
The syntax of if else statement is as follows
Some of the example programs on if else statement are shown in below:
Ex 1: A sample program on if else statement.
|enter your marks: 34
Ex 2: A program on finding climate condition.
|Temperature : 43
Ex 3 Another example program on if else statement.
|Who is this : Sudhakar
Ex 4 A program on if else statement using while loop
Ex 5: A program on evaluation of marks
|enter marks 21 #Test case 1
total marks 36
enter marks 76 #Test case 2
total marks 86
Ex 6 A program to calculate the discount and print net payable
|Enter amount: 4589
Net payable: 4130.1
Ex 7: A program to find whether the given sides form a triangle or not.
|x= 45 #Test case 1
Yes it forms a triangle
x= 24 #Test case 2
impossible to form a triangle