Computer Science, asked by nostrokegaming1234, 7 months ago

Write an algorithm to check if a person can give vote or not. Condition is that the person must cleared 12th and have age more than 18. Also draw a flowchart based on it.​

Answers

Answered by ShubhamRoy23
1

Explanation:

What is the algorithm to check whether a person can vote or not?

Upgrade to the latest electronics and appliances.

What is the algorithm to check whether a person can vote or not?

I haven’t programmed in decades, but everything is a binary condition because someone is either eligible to vote (1) or not eligible (0).

You could either set up a series of checks which will increment an eligibility counter for each disqualifying condition met and then check if it is greater than 0 at the end, but the simpler method would be go straight to the ineligible outcome if any are met because it’s an all-or-nothing proposition. If you fail to meet any of the criteria, you are ineligible to vote.

Universal criteria in the U

Delightfully capable. Surprisingly affordable.

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’

Similar questions