91-9990449935 0120-4256464 |
C if else StatementThe if statement in C language is used to perform operation on the basis of condition. By using if-else statement, you can perform operation either condition is true or false. There are many ways to use if statement in C language:
If StatementThe single if statement in C language is used to execute the code if condition is true. The syntax of if statement is given below: Flowchart of if statement in CLet's see a simple example of c language if statement. Outputenter a number:4 4 is even number enter a number:5 If-else StatementThe if-else statement in C language is used to execute the code if condition is true or false. The syntax of if-else statement is given below: Flowchart of if-else statement in CLet's see the simple example of even and odd number using if-else statement in C language. Outputenter a number:4 4 is even number enter a number:5 5 is odd number If else-if ladder StatementThe if else-if statement is used to execute one code from multiple conditions. The syntax of if else-if statement is given below: Flowchart of else-if ladder statement in CThe example of if-else-if statement in C language is given below. Outputenter a number:4 number is not equal to 10, 50 or 100 enter a number:50 number is equal to 50
Next TopicC Switch Statement
|