Decision making with if statement
The if statement may be implemented in different forms depending on the complexity of conditions to be tested. The different forms are,
Simple if statement
The general form of a simple if statement is,if(expression)
{
statement inside;
}
statement outside;
If the expression returns true,
then the statement-inside will be executed,
otherwise statement-inside is skipped and only the statement-outside is executed.
#include <stdio.h>
void main( )
{
int x, y;
x = 15;
y = 13;
if (x > y )
{
printf("x is greater than y");
}
}
Output:
x is greater than y