C program to check whether a user is eligible to vote or not.

C program to check whether a user is eligible to vote or not.

Q:-Write a C program to check whether a user is eligible to vote or not.

We are going to write a program in c which can check if the candidate is eligible to vote or not. We can do this by using a simple if-else statement.

#include<stdio.h>
#include<conio.h>

void main() 
{
int age;
 clrscr();
  printf("Enter your age=");
  scanf("%d", &age);

  if (age >= 18)
  {
    printf("User is eligible to vote");
  }
  else
  {
    printf("User is not eligible to vote");
  }
getch();
 }

Output

the eligibility criteria for a candidate to vote is the person should be 18 years of age or greater. So we will Check the age is greater than or equal to 18.

TOP