Computer Science, asked by Affanp, 6 months ago

write a program in Q Basic to display the 10 terms is equal to 4 + 8 + 12 + 16​

Answers

Answered by allysia
3

Language:

QBasic

Program:

cls

i=0

b=0

a=4

while i<10

b=b+a

a=a+4

i=i+1

wend

print(sum)

Output:

220

Explanation:

  • a,b,iare initialized.
  • While loop runs to ensure only first 10 sums are returned.
  • a,b,i increase by 4,a and 1 respectively.
  • The final sum is printed after the loop ends.

Similar questions