fork download
  1. program kivalasztas;
  2. const n = 10;
  3. var a:array [1..n] of integer;
  4. i, sorsz: 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. //mi az 5-ös sorszáma?
  15. i:=1;
  16. while (i<=n) and (a[i]<>5) do
  17. i:=i+1;
  18. sorsz:= i;
  19. write('Az 5-os elem sorszama: ',sorsz);
  20. readln;
  21. end.
Success #stdin #stdout 0s 9136KB
stdin
Standard input is empty
stdout
1 0 7 6 5 0 7 3 6 5 
Az 5-os elem sorszama: 5