Computer Science, asked by ss2221768, 10 months ago

write visual basic
Write a program to enter name and age of a person. If age is more than
ne and age of a person. If age is more than 18. display message
"Eligible to Vote" otherwise display "Not Eligible".​

Answers

Answered by Anonymous
2

Answer:

Explanation:

This is the first program that we give to students while explaining an if statement. Age is the criterion I give to them.(In India, one should cross 18 years to become eligible to vote).

Immediately they would come up with the statement like, if( age >= 18) then…

Then I would teach them the difference between writing an algorithm/program and writing a complete algorithm/program. Complete means it should work for all sorts of inputs suitably.

Then they would alter the if statement as

if ((age <=0) and (age >=110)) then

‘Invalid Input’

else if (age >=18) then

‘Eligible to Vote’

else

‘Not Eligible to Vote’

Note: We can even run a loop until the user gives a valid input.

Similar questions