elibraryportal Logo

If-else Statement in C

It is used to perform two operations for a single condition.if the value of test-condition is true, then the true block of statements will be executed. If the value of test-condition if false, then the false block of statements will be executed.

Syntax:

See in Flowchart.

If-else Statement in C

Example 1:) Check whether a number is even or odd .

Output

Enter a number:4
4 is even number
enter a number:5
5 is odd number

Example 2:) Greater or Less than number .

Output

If-else Statement in C