Advertisement
ridjis

B|A 2.nacin

Dec 4th, 2013
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. (*Napisati program koji ucitava nizove A i B prirodnih brojeva sa n elemenata i ispisuje sve
  2. prirodne brojeve (a,b) gde je element niza B deli element niza A bez ostatka.*)
  3. MODULE bda;
  4. FROM InOut IMPORT WriteString, WriteLn, WriteCard, ReadCard;
  5. TYPE NIZ=ARRAY [1..100] OF CARDINAL;
  6. VAR a,b: NIZ;
  7. i,j,n,m: CARDINAL;
  8. BEGIN
  9. (*PRVI NIZ*)
  10. WriteString('Unesite broj elemenata prvog niza: ');
  11. ReadCard(n);
  12. WriteLn;
  13. WriteString('Unesite elemente prvog niza: ');
  14. FOR i:=1 TO n DO
  15. ReadCard(a[i]);
  16. WriteLn;
  17. END;
  18. WriteLn;
  19. (*DRUGI NIZ*)
  20. WriteString('Unesite broj elemenata drugog niza: ');
  21. ReadCard(m);
  22. WriteLn;
  23. WriteString('Unesite elemente drugog niza: ');
  24. FOR j:=1 TO m DO
  25. ReadCard(b[j]);
  26. WriteLn;
  27. END;
  28. WriteLn;
  29. (*DJELJIVO*)
  30. FOR i:=1 TO n DO
  31. FOR j:=1 TO m DO
  32. IF b[j] MOD a[i] =0 THEN
  33. WriteString('(');
  34. WriteCard(a[i],1);
  35. WriteString(',');
  36. WriteCard(b[j],1);
  37. WriteString(')');
  38. END;
  39. END;
  40. END;
  41.  
  42. END bda.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement