fork download
  1. program maximum;
  2. const n = 10;
  3. var a:array [1..n] of integer;
  4. i,maxindex: integer;
  5. begin
  6. for i:=1 to n do
  7. write(i:2, ' ');
  8. writeln;
  9. randomize;
  10. a[1]:=10+random(90);
  11. write(a[1], ' ');
  12. maxindex:=1;
  13. for i:=2 to n do
  14. begin
  15. a[i]:=10+random(90);
  16. write(a[i], ' ');
  17. if a[maxindex] < a[i] then maxindex:=i;
  18. end;
  19. writeln;
  20. writeln('max: ', a[maxindex], '; sorszama: ', maxindex);
  21. readln;
  22. end.
Success #stdin #stdout 0s 9136KB
stdin
Standard input is empty
stdout
 1  2  3  4  5  6  7  8  9 10 
23 12 33 37 39 99 41 72 45 27 
max: 99; sorszama: 6