C Program to Check User is Eligible for Vote or not

In this program, the user is ask to input his/her age, depending on that we will check his age. If age is greater than or equal to 18 then we will display he/she is eligible to vote otherwise not.



Source Code
#include <stdio.h>
int main()
{
	int age ;

	// Input age
	printf("Enter the age of the person: ");
	scanf("%d", &age);

	// Check voting eligibility
	if (age>=18)
	{
		printf("You are eligible for voting.");
	}
	else
	{
		printf("You are not eligible for voting.\n");
	}

	return 0;
}
Output
Enter the age of the person: 15
You are not eligible for voting.

Enter the age of the person: 18
You are eligible for voting.