Programming Examples
Write a program to check whether the candidate’s age is greater than 17 or not
Write a program to check whether the candidate’s age is greater than 17 or not. If yes, display message ‘Eligible for Voting’?
Solution
#include<stdio.h>
void main()
{
int age;
clrscr();
printf(“\n Enter age in the years :”);
scanf(“%d”,&age);
if(age>17)
printf(“\n Eligible for Voting.”);
getch();
}
Output
OUTPUT:
Enter age in the years : 20
Eligible for Voting