This C program checks whether a person of a given gender and age is eligible to vote.
-
Compile: Compile the program using a C compiler. For example, you can use
gcc
on Linux or MinGW on Windows:gcc main.c -o voting_eligibility_checker
-
Run: Run the compiled program:
./voting_eligibility_checker
-
Input: Follow the prompts to enter the gender (M/F) and age of the person.
-
Output: The program will then display whether the person is eligible to vote or not based on their gender and age.
Enter gender (M/F): M Enter age: 25
Men are eligible to vote.
- The program accepts 'M' or 'm' for male gender and 'F' or 'f' for female gender.
- The voting eligibility age is set to 18.
- Invalid inputs for gender or age will result in appropriate error messages.
Feel free to use and modify this program according to your needs!