Computer Science, asked by hardik260106, 1 year ago

write a program in qbasic to find the sum of any 10 numbers. ( use counter and accumulator )

Answers

Answered by IamSatyam
26
dont know QBASIC but heres a simple algorithm

declare a variable s
FOR i = 1 TO 10 

input a num from user
s=s+num
 
NEXT i
PRINT (Print the value of s)

that will surely work.
Answered by Anonymous
17

CLS                  //start of the program

I=1                    //initializing I

DO                    //loop starts

PRINT I             // prints value of i

SUM = SUM + I  //formula to produce sum (initial value of sum=0)

I=I+1                    //Incrementing value of I

LOOP WHILE I<=10  //Loop condition and loop exit

PRINT "Sum=" ; SUM    // prints the sum

END                      //end of the program

Attachments:
Similar questions