Computer Science, asked by ivanteddy22, 4 months ago

write an algorithm and draw a flowchart to determine whether a person can vote or not.Note. person can vote only if the age is greater 18

Answers

Answered by dreamrob
1

Algorithm:

1) Start

2) Declare a variable: age

3) Take input from user;

4) if(age >= 18)

  1. True : Print can vote.
  2. else : False : Print cannot vote

5) End

Program in C++:

#include<iostream>

using namespace std;

int main()

{

int age;

cout<<"Enter age of the person : ";

cin>>age;

if(age >= 18)

{

 cout<<"The person can vote";

}

else

{

 cout<<"The person cannot vote";

}

return 0;

}

Attachments:
Similar questions