Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 10th, 2012  |  syntax: Pascal  |  size: 0.52 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Program Prog7;
  2. var x,y:array[1..5] of real;
  3. i:integer; S,T,L,N,A,B:real;
  4. begin
  5. for i:=1 to 5 do
  6. begin
  7. writeln('Введите элемент массива x');
  8. readln(x[i]);
  9. end;
  10. for i:= 1 to 5 do
  11. begin
  12. writeln('Введите элемент массива y');
  13. readln(y[i]);
  14. end;
  15. S:=0;
  16. for i:= 1 to 5 do S:=S+x[i];
  17. T:=0;
  18. for i:= 1 to 5 do T:=T+sqr(x[i]);
  19. L:=0;
  20. for i:= 1 to 5 do L:=L+x[i]*y[i];
  21. N:=0;
  22. for i:= 1 to 5 do N:=N+y[i];
  23. B:=(5*L-N*S)/(5*T-sqr(S));
  24. A:=(N-B*S)/5;
  25. writeln('y=',A:4:2,'+',B:4:2,'x');
  26. end.