#include <stdio.h>
#include <stdlib.h>
int main()
{
int age;
printf("Please enter the age ");
scanf("%d",&age);
if (age > 18/* condition goes here */) {
/* if the condition is non-zero (true), this code will execute */
printf("The age is greater then 18");
}
if (age == 18/* condition goes here */) {
/* if the condition is non-zero (true), this code will execute */
printf("The age is equal to 18");
}
if (age < 18/* condition goes here */) {
/* if the condition is non-zero (true), this code will execute */
printf("The age is less then 18");
}
}
Sunday, November 9, 2014
C Programming for Beginners 7 - If Statements in C
2:26 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment