Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* niz od 5 brojeva i ispituje da li uneti broj pripada nizu*)
- MODULE rz2_2;
- FROM InOut IMPORT WriteLn, WriteString, WriteCard, ReadCard;
- CONST duzina= 5;
- TYPE NIZ= ARRAY [1..duzina] OF CARDINAL;
- VAR niz: NIZ;
- i,n,s: CARDINAL;
- BEGIN
- WriteString('Unesite 5 brojeva: ');
- WriteLn;
- FOR i:=1 TO duzina DO
- WriteString('broj[');
- WriteCard(i,1);
- WriteString('] = ');
- ReadCard(niz[i]);
- END;
- WriteString('Uneli ste sledece brojeve: ');
- FOR i:=1 TO duzina DO
- WriteCard(niz[i],0);
- END;
- WriteLn;
- WriteString('unesite broj provjeru pripadnosti nizu: ');
- ReadCard(n);
- s:=0;
- FOR i:=1 TO duzina DO
- IF niz[i] = n THEN
- INC(s);
- END;
- END;
- IF s>0 THEN
- WriteString('Broj se nalazi u nizu.');
- ELSE
- WriteString('Broj se ne nalazi u nizu.');
- END;
- END rz2_2.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement