Ad Code

Responsive Advertisement

control statement if().

if condition in C language :

First we understood that why we need to the if() keyword.

first the small example. suppose, the big bazaar(shopping mall) sell the product.

there are three products  pans, book, bags

    but the condition is that
the pans price 10 Rupees.
the books price 50 Rupees.
the bags price 200 Rupees.

 If the user buy any product than they belongs to the condition.

1)the first user come to big bazaar to buy the product but he have only 50 Rupees. so the condition is that if the user have 50 rises than he can buy book.

2)second user have a 200 Rupees so he can buy a bag.

 this the condition that faced in our life but a computer program have a same problem so, in computer language we used the if() condition.




Syntex : if(condition)
                {
                      //program.
                }



Example :
 
#include<stdio. h>
 Void main()
 {
       Int a=2; 
        if(a>4)
       {
              printf(" a is greater") ;
      }
 }
 out put: a is greater.

 So, it is the if() condition to used to make a conditional in our programme.


❮ Previous                                                      Next ❯

Post a Comment

0 Comments