CLS
PRINT "A PROGRAM TO CALCULATE THE AVERAGE OF A NUMBER"
DIM NUM(1 TO 5) AS INTEGER
FOR I = 1 TO 5
INPUT "ENTER A NUMBER ", NUM(I)
NEXT I
PRINT "YOU HAVE INSERTED THESE VALUES"
FOR J = 1 TO 5
PRINT NUM(J)
NEXT J
LET SUM = 0
FOR K = 1 TO 5
LET SUM = SUM + NUM(K)
NEXT K
PRINT "TOTAL SUM IS", SUM
LET AV = SUM / 5
PRINT "THE AVERAGE IS", AV
PRINT "HERE IS THE GUIDE"
PRINT "CALCULATE ALL THE ELEMENT TOGETHER AND DIVIDE BY THE TOTAL COUNT"
PRINT "IF YOU INSERT 1,2,3, YOU WILL ADD 1 + 2 + 3 = 6, THEN DIVIDE 6 BY 3 = 2"
PRINT "HERE IS THE SOLUTION AGAIN"
LET SUM = 0
FOR K = 1 TO 5
LET SUM = SUM + NUM(K)
NEXT K
PRINT "TOTAL SUM IS", SUM
LET AV = SUM / 5
PRINT "THE AVERAGE IS", AV
END
PROGRAM RESULT
PRINT "A PROGRAM TO CALCULATE THE AVERAGE OF A NUMBER"
DIM NUM(1 TO 5) AS INTEGER
FOR I = 1 TO 5
INPUT "ENTER A NUMBER ", NUM(I)
NEXT I
PRINT "YOU HAVE INSERTED THESE VALUES"
FOR J = 1 TO 5
PRINT NUM(J)
NEXT J
LET SUM = 0
FOR K = 1 TO 5
LET SUM = SUM + NUM(K)
NEXT K
PRINT "TOTAL SUM IS", SUM
LET AV = SUM / 5
PRINT "THE AVERAGE IS", AV
PRINT "HERE IS THE GUIDE"
PRINT "CALCULATE ALL THE ELEMENT TOGETHER AND DIVIDE BY THE TOTAL COUNT"
PRINT "IF YOU INSERT 1,2,3, YOU WILL ADD 1 + 2 + 3 = 6, THEN DIVIDE 6 BY 3 = 2"
PRINT "HERE IS THE SOLUTION AGAIN"
LET SUM = 0
FOR K = 1 TO 5
LET SUM = SUM + NUM(K)
NEXT K
PRINT "TOTAL SUM IS", SUM
LET AV = SUM / 5
PRINT "THE AVERAGE IS", AV
END
PROGRAM RESULT
0 Comments
If you have further concerns, kindly drop a comment.