1. Write a program to input the age of the person and check whether the person is eligible to vote.
CLS
INPUT "Enter your age"; A
IF A >= 18 THEN
PRINT "You are eligible to vote"
END IF
END
2. Write a program to input any number and check whether the number is even or odd.
CLS
INPUT "Enter any number"; NUM
IF NUM MOD 2= 0 THEN
PRINT "The given number is even"
ELSE
PRINT "The given number is odd"
END IF
END
3. Write a program to input the age of a person and check whether the person is eligible to vote or not.
CLS
INPUT "Enter age of person"; A
IF A >=18 THEN
PRINT "Person is eligible to vote"
ELSE
PRINT "Person is not eligible to vote"
END IF
END
4. Write a program to display whether the given number is exactly divisible or not.
CLS
INPUT "Enter any number"; N
IFN MOD 7= 0 THEN
PRINT "The given number is exactly divisible by 7"
ELSE
PRINT "The given number is not exactly divisible by 7"
END IF
END
5. Write a program to display the greatest number among any three different numbers.
CLS
INPUT "Enter the first number"; N1
INPUT "Enter the second number"; N2
INPUT "Enter the third number"; N3
IF N1>N2 AND N1>N3 THEN
PRINT "The greatest number is"; N1 ELSEIF N2>N1 AND N2>N3 THEN
PRINT "The greatest number is"; N2
ELSE
PRINT "The greatest number is"; N3
END IF
END
6. Write a program to input three sides of a triangle and display whether the triangle is equilateral, isosceles, or scalene.
CLS
INPUT "Enter the first side"; A
INPUT "Enter the second side"; B
INPUT "Enter the third side";C
IF A=B AND B=C AND C=A THEN
PRINT "The triangle is equilateral"
ELSEIF A<>B AND B<>CAND C<>A THEN
PRINT "The triangle is scalene"
ELSE
PRINT "The triangle is isosceles"
END IF
END
No comments:
Post a Comment