Write a qbasic program to print the series 1,2,3,6,9,18,27,54 upto n terms
Answers
Answered by
2
The given code is written in QBASIC.
CLS
INPUT "Enter N - "; N
A = 1
FOR I = 1 TO N
PRINT A;
IF I MOD 2 = 1 THEN
A = A * 2
ELSE
A = A * 3 / 2
END IF
NEXT I
END
- Here, first term is 1. Then next term is multiplied by 2 and then next term is multiplied by 3/2 and this goes on till the Nth term.
See the attachment for output.
Attachments:
MisterIncredible:
Awesome ^_^
Similar questions
Science,
1 month ago
Math,
1 month ago
English,
1 month ago
Math,
9 months ago
Business Studies,
9 months ago