1.
DECLARE
FUNCTION TEST (N)
CLS
FOR J=
3 TO 9 STEP 2
X= TEST(J)
PRINT X
NEXT J
END
FUNCTION TEST (N)
TEST = (N^2)+ 2
END FUNCTION
2.
DECLARE
FUNCTION PATTERN (N)
B=4
PRINT PATTERN (B)
END
FUNCTION PATTERN (K)
FOR M = 1 TO K
T=T+2
D=D+T
NEXT M
PATTERN = D
END FUNCTION
3.
DECLARE FUNCTION CONVERSION(B)
CLS
Z=1111
ANS=
CONVERSION(Z)
PRINT”THE
RESULT”;ANS
END
FUNCTION
CONVERSION(B)
P=0
DO
WHILE B<>0
D=
B MOD 10
E
= D*2^P+E
B
= INT(B/10)
P
= P+1
LOOP
CONVERSION=E
END
FUNCTION
4.
DECLARE
FUNCITON PATERN(N)
B = 4
PRINT PATERN(B)
END
FUNCITON PATERN(K)
FOR M = 1 TO K
T = T+2
D = D+T
NEXT M
PATERN=D
END FUNCTION
5.
DECLARE FUNCTION A(X)
X=10
Z=A(X)
PRINT Z
END
FUNCTION A(X)
FOR I= 1 TO X STEP 2
S=S+I
NEXT I
A=S
END FUNCTION
6.
DECLARE
FUNCTION TEST (A, B)
CLS
X=2:
Y=8
PRINT
“THE RESULT IS”; TEST(X,Y)
END
FUNCTION
TEST (A, B)
FOR J =
A to B STEP 2
P=P+J
NEXT J
TEST =
P
END
FUNCTION
7. DECLARE FUNCTION TEST (N)
CLS
FOR J = 3 TO 9 STEP 2
X = TEST (J)
PRINT X
NEXT J
END
FUNCTION TEST (N)
TEST = (N ^ 2) + 2
END FUNCTION
8.
DECLARE FUNCTION XYZ (N)
S = 0
FOR K = 1 TO 4
READ XY
S = S + XYZ (XY)
NEXT K
PRINT S
DATA 5, 4, 3, 2
END
FUNCTION XYZ (N)
XYZ = (N ^ 2)\2
END FUNCTION
9.
DECLARE
FUNCTION EXAM (N)
S = 0
FOR K=1 TO 3
READ ABC
S = S + EXAM (ABC)
NEXT K
PRINT S
DATA 4, 3, 5
END
FUNCTION EXAM (N)
EXAM = (N*N*N) MOD 2
END FUNCTION
No comments:
Post a Comment