C Program To Know The Eligibility For Voter ID Card: In this, we learn how to write a program for eligibility of the voter id card using C Programming.
- In this program we are defining int age;
- We are using if and else function.
- Input from the user is collected and computing takes place.
- The results are executed.
Source Code:
#include <stdio.h>
void main()
{
int age;
printf("Enter the age of a person:");
scanf("%d", &age);
if(age>=18)
{
printf("Eligible to vote.\n");
}
else
{
printf("Not Eligible to vote.\n");
}
}
---------------------------------
Output:
Ex-1:
Enter the age of a person:18
Eligible to vote.
Ex-2:
Enter the age of a person:16
Not Eligible to vote.
Ex-3:
Enter the age of a person:22.
Eligible to vote.
Any queries feel free to comment down.
Liked the content then support us by sharing with your friends.
No comments:
Post a Comment