A simple example of the if statement
#include <stdio.h>
void main()
{
int number = 0;
printf("\nEnter an integer between 1 and 10: ");
scanf("%d",&number);
if (number > 7)
printf("You entered %d which is greater than 7\n", number);
if (number < 3)
printf("You entered %d which is less than 3\n", number);
}
Related examples in the same category