Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Level 7 QBASIC Looping paper 2

1. Write a program to print your name 10 times using For…Next


loop.
FOR i = 1 TO 10
PRINT "Eyad"
NEXT i

2. Write a program to input your name 10 times using For…Next


loop.

FOR i = 1 TO 10
INPUT "enter your name ; ", e$
NEXT i

3. Write a program to print the first 10 natural numbers in reverse


order using For…Next loop.

FOR i = 10 TO 1 STEP -1
PRINT i
NEXT i
4. Write a program to print numbers 10 to 15 using For… Next loop

FOR i = 10 TO 15
PRINT i
NEXT i

5. Write a program to print the series: 0, 2, 4, 6, 8, 10, 12 using For…


Next loop.
Level 7 QBASIC Looping paper 2

FOR i = 0 TO 12 STEP 2
PRINT i
NEXT i

6. Write a program to print the series: 0, 1.5, 3, 4.5, 6 using For…


Next loop.
FOR i = 0 TO 6 STEP 1.5
PRINT i
NEXT i

7. Write a program to print all the odd numbers between 1 to 10


using For…Next loop
FOR i = 1 TO 10 STEP 2
PRINT i
NEXT i

8. Write a program to print all the even numbers between 1 to 10


using For…Next loop.
FOR i = 2 TO 10 STEP 2
PRINT i
NEXT i

9. Write a program to print in descending order, the series of odd


numbers between 10 and 110 using For…Next loop.
FOR i = 109 TO 10 STEP -2
PRINT i
NEXT i
10. WAP using For…Next loop to print the sum of any 10
numbers.
Level 7 QBASIC Looping paper 2

For i = 1 to 10
Input “enter number :”,a
b= b + a
Next i
Print ” the sum=:”,b

11. Write a program using For…Next loop to find the sum of the
series: 1+2+3+4+5.

For i = 1 to 5
Sum = sum +i
Next i
Print “ the sum = “,sum

12. Write a program using For…Next loop to find the average


age of 10 students.

For i = 1 to 10
Input “ enter your age :”,age
Sum = sum + age
Next i
Avg = sum /10
Print “ the average:” ,avg

13. WAP to input name and marks of a student in 5 subjects and


print the total marks, percentage and average marks.
Level 7 QBASIC Looping paper 2

Cls
For i = 1 to 5
Input “ marks :”, m
Sum = sum + m
Next i
Print “total marks in 5 subject :”, num
Avg = sum /5
Print “ average of marks :”,avg
Per = (sum *100)/500
Print “percentage of marks :”, per

14. WAP using For…Next loop , to input names and marks in


four subjects of 25 students, and calculate the total marks,
percentage and average of each student. Print the name, marks,
total marks, average and percentage of each student.

Cls
For i =1 to 25
Input “student’s name :”, n$
Print n$
Input “history :”,h
Print h
Input “ math:”,m
Print m
Input “computer :”,c
Level 7 QBASIC Looping paper 2

Print c
Input “English:”,e
Print e
Total = h+m+c+e
Print “total=”,total
Per=(total *100)/400
Print “percentage:”,per
Avg = total/4
Print “average:”,avg
Next i

15. Write a program using For…Next loop to find the sum of the
series of even numbers between 215 and 315.

FOR i = 216 TO 315 STEP 2


Sum = Sum + i
PRINT i
NEXT i
PRINT "sum :", Sum
Level 7 QBASIC Looping paper 2

16. Write a program using For…Next loop to find the sum of the
series: 5, 10, 15, ……………. , 50

FOR i = 5 TO 50 STEP 5
PRINT i
sum = sum + i

NEXT i
PRINT "sum:", sum

17. Write a program using For…Next loop to print the table of 5.

FOR I = 1 TO 10
PRINT "5 ", "*", I; "=", 5 * I
NEXT I

You might also like