1) Write a program that asks marks in any subject and display the message “Result Pass” if the input number is greater than 40.
CLS
INPUT “Enter marks in computer”; C
IF C>= 40 THEN PRINT “Result Pass”
ELSE PRINT “Result fail”
END
INPUT “Enter marks in computer”; C
IF C>= 40 THEN PRINT “Result Pass”
ELSE PRINT “Result fail”
END
2) Write a program that asks any two number and display the greater one.
CLS
INPUT “Enter first number”; A
INPUT “Enter second number”; B
IF A>B THEN
PRINT “The greater number is”; A
ELSE
PRINT “The greater number is”; B
END IF
END
INPUT “Enter first number”; A
INPUT “Enter second number”; B
IF A>B THEN
PRINT “The greater number is”; A
ELSE
PRINT “The greater number is”; B
END IF
END
3) Write a program that checks whether the supplied number is odd or even.
CLS
INPUT “Enter any number”; N
IF N MOD 2= 0 THEN
PRINT “Even number”
ELSE
PRINT “Odd number”
END IF
END
INPUT “Enter any number”; N
IF N MOD 2= 0 THEN
PRINT “Even number”
ELSE
PRINT “Odd number”
END IF
END
4) Write a program that asks any two number and displays the difference between greater and smaller one.
CLS
INPUT “Enter first number”; A
INPUT “Enter second number”; B
IF A>B THEN
D= A-B
ELSE
D= B-A
END IF
PRINT “Difference of greater and smaller number =”; D
END
INPUT “Enter first number”; A
INPUT “Enter second number”; B
IF A>B THEN
D= A-B
ELSE
D= B-A
END IF
PRINT “Difference of greater and smaller number =”; D
END
5) Write a program that asks your age and tells whether you are eligible to vote or not. ( A person who is 18 years old or above is eligible to vote.
CLS
INPUT “Enter your age”; A
IF A>= 18 THEN
PRINT “You are eligible to vote”
ELSE
PRINT “You are not eligible to vote”
END IF
END
INPUT “Enter your age”; A
IF A>= 18 THEN
PRINT “You are eligible to vote”
ELSE
PRINT “You are not eligible to vote”
END IF
END
6) Write a program to print the smallest number among 3 input numbers.
CLS
INPUT “Enter any three number”; a, b, c
IF A<B AND A<C THEN
PRINT “The smallest number is”; A
ELSE IF B<A AND B<C THEN
PRINT “smallest number is”; B
ELSE
PRINT “smallest number is”; C
END IF
END
INPUT “Enter any three number”; a, b, c
IF A<B AND A<C THEN
PRINT “The smallest number is”; A
ELSE IF B<A AND B<C THEN
PRINT “smallest number is”; B
ELSE
PRINT “smallest number is”; C
END IF
END
7) Write a program that asks marks in 3 different subjects and display message pass or fail. ( The pass marks for each subjects is 40.
CLS
INPUT “Enter marks in three subjects”; a, b, c
IF A>= 40 AND B>= 48 AND C>=40 THEN
PRINT “you are pass”
ELSE
PRINT “You are fail”
END IF
END
INPUT “Enter marks in three subjects”; a, b, c
IF A>= 40 AND B>= 48 AND C>=40 THEN
PRINT “you are pass”
ELSE
PRINT “You are fail”
END IF
END
8) Write a program using FOR……. NEXT statement to print natural numbers up to 15.
CLS
FOR I= 1 TO 15
PRINT I
NEXT I
END
FOR I= 1 TO 15
PRINT I
NEXT I
END
9) Write a program using FOR…… NEXT statement to print even numbers from 2 to 20.
CLS
FOR I= 2 TO 20 STEP 2
PRINT I
NEXT I
END
FOR I= 2 TO 20 STEP 2
PRINT I
NEXT I
END
10) Write a program using WHILE…… WEND statement to print first 10 odd numbers.
CLS
FOR I = 1 TO 20 STEP 2
PRINT I
NEXT I
END
FOR I = 1 TO 20 STEP 2
PRINT I
NEXT I
END
11) Write a program using DO WHILE……. LOOP statement to generate numbers 2, 5, 8, 11…, 32.
CLS
FOR I = 2 TO 32 STEP 3
PRINT I
NEXT I
END
FOR I = 2 TO 32 STEP 3
PRINT I
NEXT I
END
12) Write a program to print numbers; 100, 95, 90…,5 using any one of the looping structure.
CLS
FOR I = 100 TO 5 STEP -5
PRINT I
NEXT I
END
FOR I = 100 TO 5 STEP -5
PRINT I
NEXT I
END
13) Write a program to print sum of first 15 natural numbers using any one of the looping structures.
CLS
FOR I = 1 TO 15
S = S+I
NEXT I
PRINT “sum=”; S
|END
FOR I = 1 TO 15
S = S+I
NEXT I
PRINT “sum=”; S
|END
14) Write a program to print sum of even number from 2 to 10 using any one of the looping structures.
CLS
FOR I = 2 TO 10 STEP 2
S = S + I
NEXT I
PRINT “Sum=”; S
END
FOR I = 2 TO 10 STEP 2
S = S + I
NEXT I
PRINT “Sum=”; S
END
15) Write a program to print sum of odd numbers between 2 to 21 using any one of the looping structures.
CLS
FOR I = 1 TO 21 STEP 2
S = S + I
NEXT I
PRINT “Sum=”; S
END
FOR I = 1 TO 21 STEP 2
S = S + I
NEXT I
PRINT “Sum=”; S
END
16) Write a program to print even numbers from 20 to 40.
CLS
FOR I = 20 TO 40 STEP
PRINT I
NEXT I
END
FOR I = 20 TO 40 STEP
PRINT I
NEXT I
END
17) Write a program to find product of first ten natural numbers.
CLS
P = 1
FOR I = 1 TO 10
P = P*1
NEXT I
PRINT “Product=”; P
END
P = 1
FOR I = 1 TO 10
P = P*1
NEXT I
PRINT “Product=”; P
END
18) Write a program to generate multiplication table of input number.
CLS
INPUT “Enter any number”; N
FOR I = 1 TO 10
PRINT N; “X” I; “=”; N*I
NEXT I
END
INPUT “Enter any number”; N
FOR I = 1 TO 10
PRINT N; “X” I; “=”; N*I
NEXT I
END
19) Write a program to print numbers 1, 8, 27…1000.
CLS
FOR I = 1 TO 10
PRINT I^3
NEXT I
END
FOR I = 1 TO 10
PRINT I^3
NEXT I
END