Simple if statement in C language


Simple if statement in C language

Simple if statement in C language is a very powerful decision making statement and it is used to control the flow of execution of statements.

There are four types of if statement:

  • Simple if
  • If else
  • Nested if
  • If else if ladder

Simple if statement in C language

 In simple if statement, there is only one Condition and depending upon the Condition, a particular set of statements will be executed. The syntax of simple if statement is:

Test is conditional expression. If it is true, Block  of statements gets executed. otherwise Block will not execute. Block  is a set of C language statements .

Program to demonstrate simple if statement in C Language.
int main()
int a=10;
  printf("number is -ve");
return 0;

In the above program, a is 10. 

Condition a<0 is false so only printf(“\nBye”) would be executed.

Spread the love
Lesson tags: if statement in c, simple if statement in c, types of if statement in c
Back to: C Programming Language
Spread the love