Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. program esercizio5pag26;
  2. const
  3. dim=100;
  4. type
  5. tipo=array[1..dim]of integer;
  6. var
  7. V1:tipo;
  8. minimo,massimo:integer;
  9. i,N:integer;
  10. procedure calcolominimo(x:tipo;d:integer);
  11. begin
  12. minimo:=X[1];
  13. for i:=2 to d do
  14. begin
  15. if(X[i]<minimo)then
  16. minimo:=X[i];
  17. end;
  18. end;
  19. procedure calcolomassimo(Y:tipo;d:integer);
  20. begin
  21. massimo:=Y[1];
  22. for i:=2 to d do
  23. begin
  24. if(Y[i]>massimo)then
  25. massimo:=Y[i];
  26. end;
  27. end;
  28.  
  29. begin
  30. repeat
  31. writeln('Dammi la dimensione');
  32. readln(N);
  33. until(N>0)and(n<=dim);
  34. for i:=1 to N do
  35. begin
  36. randomize;
  37. V1[i]:=random(51);
  38. end;
  39. calcolominimo(V1,N);
  40. writeln(minimo);
  41. calcolomassimo(V1,N);
  42. writeln(massimo);
  43. readln;
  44. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement