Write a C Program to check whether a Person is eligible to Vote or not
In this tutorial we are writing a C Program to Check Eligibility for voting.
In India, to be eligible for voting, a person's age should be 18 or greater than 18We will use this criteria with the if else Conditional statement in our program.
Program Source Code : eligible_for_voting.c
1 #include <stdio.h>
2
3 int main()
4 {
5
6 int age;
7
8 printf("Enter age : ");
9 scanf("%d", &age);
10
11 if (age >= 18)
12 printf("You can Vote!");
13 else
14 printf("You cant Vote!");
15
16 return 0;
17 }
Program Output : Run 1
Enter age : 20
You can Vote!
Program Output : Run 2
Enter age : 18
You can Vote!
Program Output : Run 3
Enter age : 17
You can't Vote!