Advertisement
deced

Untitled

Mar 18th, 2021
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.66 KB | None | 0 0
  1. var
  2.     XArr, YArr, MArr: array [0 .. 5] of Real;
  3.     Xc, Yc, MSum, XSum, YSum: Real;
  4.     I: Integer;
  5.  
  6. procedure Calc();
  7. begin
  8.     Xc := XSum / MSum;
  9.     Yc := YSum / MSum;
  10. end;
  11.  
  12. begin
  13.     MSum := 0;
  14.     XSum := 0;
  15.     YSum := 0;
  16.     for I := 0 to 5 do
  17.     begin
  18.         Write('x', I, ' = ');
  19.         Readln(XArr[I]);
  20.         Write('y', I, ' = ');
  21.         Readln(YArr[I]);
  22.         Write('m', I, ' = ');
  23.         Readln(MArr[I]);
  24.         XSum := XSum + (XArr[I] * MArr[I]);
  25.         YSum := YSum + (YArr[I] * MArr[I]);
  26.         MSum := MSum + MArr[I];
  27.     end;
  28.     Calc();
  29.     Writeln('X = ', Xc:0:3);
  30.     Writeln('Y = ', Yc:0:3);
  31.     Readln;
  32. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement