fork download
  1. program kivalogatas;
  2. const n = 10;
  3. var a, b: array [1..n] of integer;
  4. i, j: integer;
  5. begin
  6. randomize;
  7. //a tömb elkészítése
  8. for i:=1 to n do
  9. begin
  10. a[i]:=random(8);
  11. write(a[i], ' ');
  12. end;
  13. writeln;
  14. //válogassuk ki az 5-osoket a b-tombbe!
  15. j:=0;
  16. for i:=1 to n do
  17. if a[i]=5 then begin
  18. j:=j+1;
  19. b[j]:=i;
  20. end;
  21. writeln('az 5-osok sorszamai:');
  22. for i:=1 to j do
  23. write(b[i], ' ');
  24. readln;
  25. end.
Success #stdin #stdout 0s 9120KB
stdin
Standard input is empty
stdout
3 0 7 3 5 4 5 7 4 7 
az 5-osok sorszamai:
5 7