VAR NF,MF, NMF: INTEGER;
FUNCTION FACT(K:INTEGER):INTEGER;
VAR PF,I: INTEGER;
BEGIN
IF K<0 THEN FACT =0 ELSE
IF K=0 THEN FACT =1 ELSE
BEGIN PF:=1;
FOR I:=2 TO K DO PF:=PF*I;
FACT:=PF;
END;
END.
BEGIN
READ (N,M);
NF:=FACT(N);
MF:=FACT(N);
NMF:=FACT(N-M);
WRITE(‘NF=’;NF,’MF=’;MF,’NMF=’;NMF);
END.
(Topshiriq: Ushbu misolni amaliyotda komp'yuterga kiritib tekshirib ko’ring)
Misol:
y=ax
2
+bx+d;
n
i
100 20
a=
t
i
; b=
t
i
d=
qi
i=1 i=n
i
+1 i=1
j
SUM=
masi
i=k funktsiyadan foydalanamiz.
Dastur:
PROGRAM FUNY (INPUT,OUTPUT);
CONST N=100;
TYPE INDEX =1,...,N;
VECT= ARRAY [INDEX] OF REAL;
VAR I,NR,NT,NG: INTEGER;
T,Q: VECT;
Y:REAL;
FUNCTION SUM (MAS:VECT; K:INTEGER; MM:INDEX):REAL;
VAR J:INTEGER;
BEGIN
S:=O;
FOR J:=1 TO MM DO S:=S+MAS(J);
SUM:=S;
END;
BEGIN
READ (NR, NT, NQ);
FOR I:=1 TO NT DO READ(T(I));
FOR J:=1 TO NQ DO READ(Q(I));
Y:=SUM(T,1,NR)*X*X*SUM(T,NR,+1,NT)*X
+SUM(Q,1,NQ);
WRITE(‘Y=’;Y);
END.
Protsedura bir necha natijalarni olish uchun ishlatiladi. Protseduraning umumiy
ko’rinishi:
0>