if else statement in C language
if else statement contains one condition. If condition evaluates to true, one set of statements will execute. If condition is false other set of statements will execute.
Syntax of if else statement is:
Condition-Expression is any conditional expression. If it is true, then Statements-1 will execute otherwise Statements-2 will execute.
Statements-1, Statements-2 are set of valid C Language statements.
printf(“\nEnter a number:=”);
|Enter a number:= -7
In the above program, a has been entered -7. Condition a>0 is false so printf(“Not positive”) will be executed.