Home » Blog » Simple if Statement In C

Simple if Statement In C

Decision making with if statement may be implemented in different forms depending on the complexity of conditions to be tested.The different forms are,

  1. Simple if statement
  2. if….else statement
  3. Nested if….else statement
  4. Using else if statement


	//Inside Statement Are Executed
	//Outside Statement Are Executed

Here, If  the expression evaluated as true then inside statements are executed, otherwise outside statements are executed.

If the if block has only one statement then there is no need to put curly braces {}, but if the if block has more then one statement then it must put curly braces.

Example is below

#include <stdio.h>

void main()
    int x,y;
    x = 15;
    y = 13;
    if (x > y )
        printf("x is greater than y");


x is greater than y

It’s Done. Keep It Up Guys…

Leave a Reply

Your email address will not be published.