Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*Data su dva niza ciji su elementi prirodni brojevi.
- Napisati program koji ispisuje sve brojeve koji se nalaze u oba niza. *)
- MODULE uoba;
- FROM InOut IMPORT WriteCard, ReadCard, WriteString, WriteLn;
- TYPE niz= ARRAY [1..100] OF CARDINAL;
- VAR n1,n2: niz;
- i,j,n,m: CARDINAL;
- nadjen: BOOLEAN;
- BEGIN
- WriteString('unesite broj elemenata prvog niza: ');
- ReadCard(n);
- WriteLn;
- WriteString('Unos elemenata prvog niza: ');
- WriteLn;
- FOR i:=1 TO n DO
- ReadCard(n1[i]);
- WriteLn;
- END;
- WriteString('unesite broj elemenata drugog niza: ');
- ReadCard(m);
- WriteLn;
- WriteString('Unos elemenata drugog niza: ');
- WriteLn;
- FOR i:=1 TO m DO
- ReadCard(n2[i]);
- WriteLn;
- END;
- (* FOR i:=1 TO n DO
- FOR j:=1 TO m DO
- IF n1[i]=n2[j] THEN
- WriteCard(i,2);
- END;
- END;
- END; *)
- (* (*OBJASNJENJE*)
- FOR i:=1 TO n DO
- j:=1;
- nadjen:=FALSE;
- WHILE (j<=m) AND NOT nadjen DO
- IF n1[i]=n2[j] THEN
- nadjen:=TRUE;
- WriteCard(n1[i],0);
- END;
- INC(j);
- END;
- END; *)
- END uoba.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement