Conditional statements in C:

In C programming language there are four conditional statements. There are four types of conditional statements in C programming language.

  • If
  • If else
  • Else if ladder
  • Nested if

When we need to use conditional statements:

There are several reason we need to use the conditional statements. Suppose in particular situation you want to execute only some part of the code alone that time you need to use conditional statements. Most probably if we are getting input from the user from the input statements or else if we are getting some parameters from some other function by the time we might not have any idea what are the possible value for that. Now we are going to explain about If statements.


If conditional statement :

Flow Diagram :

Syntax :



// Block of statements executes only if the condition is true


Normally we use if condition only if we want to check possible cases alone. It will execute only for success case. If the scenario is failed by the time the block of “if” condition will not execute.  Block of code only execute only if the condition is true otherwise it will skip the block.


Consider the college admission details. They will consider the college fees deduction of Rs. 5000 for admission if the student is joined in sports quota. Otherwise he has to pay complete fees amount Rs. 27000.

We suggest you to try this program by minimize the computer window and try by yourself.
Example Code :



Student name : Techybook

Your Age : 21

Techybook  Are you sports man Press 1  : 1

Dear Techybook you need to pay fees : 22000.000000


Previous Page Home Next Page