4.
Using FUNCTION, write a
program to input any five numbers and display their sum using array (DIM)
DECLARE FUNCTION SUM (N
( ))
CLS
DIM N( 5)
FOR I = 1 TO 5
INPUT "Enter any 5 numbers"; N (I)
NEXT I
PRINT "Sum of any
5 numbers is"; SUM(N ( ))
END
FUNCTION SUM (N ( ))
FOR I = 1 TO 5
S = S + N (I)
NEXT I
SUM = S
END
FUNCTION
No comments:
Post a Comment