Program to check the person can vote or not using if else

 



Program to check if a person is allowed to vote or not

    In this program you need to check and print whether a person can vote or not. The legal age to vote is 18. If the age entered by user is less than 18 print "Person cannot vote" and if the age entered by user is greater than or equal to 18 print "Person can vote". 


Code

#include <bits/stdc++.h>
using namespace std;


int main() {
    
    int age;
    cin>>age;
    
    if(age>=18){
        cout<<"Person can vote"<<endl;
    }
    else{
        cout<<"Person cannot vote"<<endl;
    }
    
    return 0;
}



Input:
19

Output: 
Person can vote


Input:
17

Output: 
Person cannot vote





!! SUBSCRIBE FOR MORE JOBES & CODES !!

Post a Comment

0 Comments