C program to check person is eligible for voting or not: In this tutorial, we are going to see one simple program that is to check whether the person is eligible for voting or not.
We can implement this program in two ways

Using the first method:
First, we take the input the age of the person to check eligibility for voting.
We write the condition that is input > 18 then, if true we print person is eligible for voting
Else a person is not eligible.

Using the second method:
Take the input date of birth from the user.
Calculate current age by using a date of birth of the user.
Now compare the age of a person, age > 18
If true, then a print person is eligible for voting.
Else the person is not eligible for voting.

Algorithm to check eligibility for voting

  1. Take age input. age
  2. Check condition
    if age >= 18
    Print person is eligible for voting
    else
    Print person is not eligible for voting

C program to check person is eligible for voting or not

#include<stdio.h>

int main()

{

int age ;

//take input age from user

printf("Enter the age of the person: ");

scanf("%d",&age);

//check voting eligibility

if (age>=18)

{

printf("person is eligible for voting");

}

else

{

printf("person is not eligibal for voting\n");

}
return 0;
}

 

Output:

C program to check person is eligible for voting or not

Write A Comment