May 20, 2020

If statement in C

When we need to enter the block only when given condition is true then we use if-statement. means we enter the if block only if given condition is true.



Synatx of if-statement:

if(condition)
{
               .
               .
      // block of Statements
;
}


Above syntax shows the working of if-statement. Which shows when if condition is true then it enters in if's block. Otherwise it goes outside the if block.
Let know more about if-statement with one example:


#include<stdio.h>
void main()
{

int a=15;

     if(a>10)
     {
printf("a is greater than 10");
     }

}


Above program shows the following output:




Share This:    Facebook Twitter

0 comments:

Post a Comment

If you have any doubts, please discuss here...