Write a program in QBASIC
print the following series :
0, 7 , 15 , …. N terms( N should be taken input from
user)
Answers
Answered by
2
Language:
Qbasic
Patterns used:
0, 7 , 15 , 24, 34 ... N
Program:
CLS
INPUT "Enter tge value of N: "; N
FOR I = 0 TO N
sum= sum + 7 + i
NEXT I
PRINT sum
END
Explanation:
- Input accepts N.
- Runs a loop N times, and adds value of 7+ i to it where i is the number of times the loop has ran at that moment of time.
- Prints last value of sum as the loop ends.
Similar questions