194k views
0 votes
Write a program that reports whether or not someone is eligible to run for president in the U.S. You should do the following in your program:

Ask the user for their age, and store it in a variable
Ask the user if they are a citizen of the U.S.
Ask the user how long they’ve been a resident in the U.S.
Use an if/else statement with the proper comparison operator to print You are eligible to run for president! if they have the following credentials:
They are at least 35 years old
They were born in the U.S.
They have been a resident for at least 14 years

User Spg
by
5.6k points

1 Answer

3 votes

Answer:
Not sure which language are you using, so I'm using python.

# getting the information
age = input("What is your age?")

citizen = input ("Are you are US citizen? (Y/ N)")

duration = input ("How many years have you been staying in the US?")

# print the line if one fits all requirements

if (age >= 35 || citizen == Y || duration >= 14) :

print ("You are eligible to run for president!")

else :

return

User Kurtis Jungersen
by
6.1k points