hlo just ansr my qstn plz....... solve out this program.....
Attachments:
Answers
Answered by
19
☆☞ Program in java ☜☆
import java.io.*;
class vote
{
public static void main(String args[])throws IOException
{
int age ;
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader in=new BufferedReader(read);
System.out.println( " Enter your age " );
age = Integer.parseInt( in .readLine());
{
if ( age > 17)
{
System.out.println( " U r eligible to vote ");
}
else
{
System.out.println( " U r not eligible to vote" );
}
}
}
}
⠀⠀⠀⠀
⠀⠀⠀⠀
⠀⠀⠀⠀
- " ; " this symbol should be used only when required . It can't be used after each line . Unnecessary use of this symbol will result showing errors in a program while compiling.
⠀⠀⠀⠀
- Java is case sensitive therefore Capital letters and small letters should be carefully used.
⠀⠀⠀⠀
- Close as many parenthesis as many uh had opened . Otherwise program will not get complied .
⠀⠀⠀⠀
- In the program if else statement was used becoz 2 conditions were given in case of more than 2 conditions other statements can be used such as :- ( if , else if ) ( if , if ) and soo on.
⠀⠀⠀⠀
⠀⠀⠀⠀
⠀⠀⠀⠀
☆☞ Program in python ☜☆
⠀⠀⠀⠀
age = int( input (" enter age : "))
⠀⠀⠀⠀
eligibility
⠀⠀⠀⠀
if age < = 18 :
⠀⠀⠀⠀
status = " eligible "
⠀⠀⠀⠀
else :
⠀⠀⠀⠀
status = " not eligible "
⠀⠀⠀⠀
print( " you are " , status , " for vote " )
Similar questions