MeroPaper

# Important QBASIC Programs for Grade 9

To input any three number and find the smallest one.

CLS

INPUT “ENTER ANY THREE NUMBERS”; A, B, C

IF A < B AND A < C THEN

PRINT A; “IS SMALLEST”

ELSEIF B < A AND B < C THEN

PRINT B; “IS SMALLEST”

ELSE

PRINT C; “IS SMALLEST”

END IF

END

To print even number from 50 to 100.

CLS

FOR I=50 TO 100 STEP 2

PRINT I

NEXT I

END

To print square numbers of 1 to 10.

CLS

FOR I = 1 TO 10

PRINT I^2

NEXT I

END

To print 1,9,25,49,81,…. up to 10th term.

CLS

A=1

FOR I = 1 TO 10

PRINT A^2;

A=A+2

NEXT

END

To input a number and check whether it’s positive, negative or zero.

CLS
INPUT “Enter a no.: ”; n

IF N>0 THEN PRINT “Positive”

IF N<0 THEN PRINT “Negative”

IF N=0 THEN PRINT “Zero”

END

To input marks of all subjects and print total, percentage, result and division.

CLS

INPUT “MARKS IN ENGLISH”; E

INPUT “MARKS IN NEPALI”; N

INPUT “MARKS IN MATHS”; M

INPUT “MARKS IN SCIENCE”; S

INPUT “MARKS IN SOCIAL”; SO

INPUT “MARKS IN HPE”; H

INPUT “MARKS IN OPTIONAL MATHEMATICS”;O

INPUT “MARKS IN COMPUTER”;C

IF N>=40 AND S>=40 AND SO>=40 AND E>=40 AND M>=40 AND O>=40 AND H>=40 AND C>=40 THEN

RESULT\$=”PASS”

ELSE

RESULT\$=”FAIL”

END IF

TOTAL = N + S + SO + E + M + O + H + C

PERCENT = (TOAL / 800) * 100

IF PERCENT >=80 THEN

DIV\$ = “DISTINCTION”

ELSEIF PERCENT >=60 THEN

DIV\$ = “FIRST”

ELSEIF PERCENT >= 45 THEN

DIV\$ = “SECOND”

ELSE

DIV\$ = “THIRD”

END IF

PRINT “TOTAL: “;TOTAL

PRINT “PERCENT: “;PERCENT

PRINT “DIVISION: “;DIV\$

PRINT “RESULT: “;RESULT\$

END

## Practice Questions

1. Write a program to enter your name and print it .
2. Write a program to enter your name, city, country, age and print them.
3. Write a program to find the area of rectangle.
4. Write a program to find the area of the triangle.
5. Write a program to find the area of the circle.
6. Write a program to find the circumference of the circle.
7. Write a program to find the area of the square.
8. Write a program to find the area of the square and cube.
9. Write a program to find the volume of the box.
10. Write a program to convert the weight from kilogram to pounds.
11. Write a program to convert the distance from kilometer to miles.
12. Write a program to convert the distance from miles to kilomiles.
13. Write a program to find out the simple Interest.
14. Write a program to find out the simple Interest and the Amount.
15. Write any number and find it’s half.
16. Write a program to find the area of four walls of a room.
17. Write a program to find the perimeter of a rectangle.
18. Write a program to enter any three numbers,sum and the average.
19. Write a program to enter any two numbers their Sum,Product and the Difference.
20. Write a program to find the average of three different numbers.
21. Write a program to input student’s name,marks obtained in four different subjects,find the total and average marks.
22. Write a program to find 10%,20% and 30% of the input number.
23. Write a program to convert the distance to kilometer to miles.
24. Write a program to find the perimeter of square.
25. Write a program to enter the Nepalese currency and covert it to Indian Currency.
26. Write a program to enter the Indian currency and covert it to Nepalese Currency.
27. Write a program to enter any number and find out whether it is negative or positive.
28. Write a program to enter any number and find out whether it is even or odd using select case statement.
29. Write a program to check the numbers between 1 & 3.
30. Write a program to enter any alphabet and test alphabet is ‘a’ or not using the select case statement.
31. Write a program to enter any alphabet and find out whether the number is vowel or alphabet.
32. Generate the following numbers using For….Next…..Loop.
1,2,3,4,…,50
33. Generate the following numbers using For….Next…..Loop.
1,3,5,7,9,….99
34. Generate the following numbers using For….Next…..Loop.
2,4,6,8,10,…50
35. Generate the following numbers using For….Next…..Loop.
1,3,5,7,…99
36. Generate the following numbers using For….Next…..Loop.
5,10,15,…90
37. Generate the following numbers using For….Next…..Loop.
10,20,30,40,…100.
38. Generate the following numbers using For….Next…..Loop.
2,4,6,8,10….50
39. Write a program to print numbers stated below USING WHILE…WEND STATEMENT.
1,3,5,7,9,…99
40. Write a program to print numbers stated below USING WHILE…WEND STATEMENT.
1,4,9,…upto 10th term.