Write a C program to check whether a user is eligible to vote or not.
Description:
You need to create a C program to check whether a user is eligible to vote or not.
Conditions:
- Minimum age required for voting is 18.
- You can use decision making statement.
#include <stdio.h>
int main()
{
unsigned int age;
printf("Enter your age=");
scanf("%d", &age);
if (age >= 18)
{
printf("User is eligible to vote");
}
else
{
printf("User is not eligible to vote");
}
return 0;
}
Tutorials Class - Output Window
Enter your age=28
User is eligible to vote
Learn more about the similar topics:
Tutorials |
---|
No Content Found. |
Exercises & Assignments |
---|
No Content Found. |
Interview Questions & Answers |
---|
No Content Found. |