Write a program in QBASIC and draw a flowchart
to find the sum of the following series :
S = 1 +22 + 33 ……………. N
allysia:
uh do you mean 11 + 22 + 33 ?
Answers
Answered by
2
Language:
Qbasic
Flowchart:
Consider the attachment.
Program:
CLS
INPUT "enter n:";n
sum=1
FOR i= 2 TO n:
sum=sum+(11*i)
NEXT i
PRINT sum
END
Output:
Consider the attachment.
Explanation:
- Line 1: Clears screen.
- Line 2: Takes input in n.
- Line 3: Initializes sum.
- Line 4: Runs loop till n.
- Line 5: Increases sum by 11*i where i is no. of times the loop ran.
- Line 6: Prints final value of sum.
- Line 7: Ends the program.
Attachments:
Similar questions