Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MODULE kolo;
- FROM InOut IMPORT WriteString,WriteLn,WriteInt;
- FROM PolinomN IMPORT Polinom,Stampaj,Ucitaj,Puta,NadjiStepen;
- PROCEDURE Parni(p:Polinom; VAR j:INTEGER);
- VAR i:INTEGER;
- BEGIN
- IF p.st>-1 THEN
- FOR i:=0 TO p.st DO
- IF i MOD 2 = 0 THEN
- IF p.k[i]>0.0 THEN
- INC(j);
- END;
- END;
- END;
- END;
- WriteInt(j,0);
- END Parni;
- PROCEDURE Prethodni(p:Polinom);
- VAR i:INTEGER;
- BEGIN
- IF p.st>-1 THEN
- FOR i:=0 TO p.st DO
- IF (p.k[i]#0.0) AND (p.k[i]>p.k[i+1]) THEN
- p.k[i]:=0.0;
- END;
- END;
- END;
- NadjiStepen(p);
- Stampaj(p,0);
- END Prethodni;
- VAR p,q,pq,r,w,x,xp:Polinom;
- j:INTEGER;
- ok:BOOLEAN;
- BEGIN
- (*A*)
- WriteString('Unesite polinom p(x): ');
- Ucitaj(p);
- WriteLn;
- (*q(x)*)
- q.st:=5;
- q.k[5]:=3.0;
- q.k[3]:=2.0;
- q.k[0]:=9.0;
- Puta(p,q,pq,ok);
- IF ok THEN
- WriteString('p(x)*q(x)= ');
- Stampaj(pq,0);
- ELSE
- WriteString('Stepen izvan granica!');
- END;
- WriteLn;
- (*B*)
- x.st:=5;
- x.k[5]:=8.0;
- x.k[2]:=7.0;
- Puta(x,p,xp,ok);
- Puta(xp,q,r,ok);
- WriteString('r(x) = ');
- Stampaj(r,0);
- WriteLn;
- (*C*)
- WriteString('Broj monoma sa parnim stepenom: ');
- Parni(r,j);
- WriteLn;
- (*D*)
- WriteString('Monomi kojima je koef veci od predhodnog: ');
- Prethodni(r);
- WriteLn;
- END kolo.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement