C program to check whether a person is eligible for voting or not?

In this program, we are going to learn how to check that, a person is eligible for voting or not, when age is given or input through the user?
Submitted by Manju Tomar, on October 13, 2017

Given age of a person and we have to check whether person is eligible for voting or not.

To check that a person is eligible for voting or not, we need to check whether person's age is greater than or equal to 18. For this we are reading age in a variable a and checking the condition a>=18, if the condition is true, "person will be eligible for voting" else not.

Consider the program:


int main()
	int a ;
	//input age
	printf("Enter the age of the person: ");

	//check voting eligibility
	if (a>=18)
		printf("Eigibal for voting");
		printf("Not eligibal for voting\n");

	return 0;


First run:
Enter the age of the person: 21
Eigibal for voting

Second run:
Enter the age of the person: 15
Not eligibal for voting

It's a simple program and I hope your concept of checking a condition may clear, if there is any mistake then write your comment in the comment box.

C Basic Programs »

Related Programs


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.