M
M
Mors Clamor2017-05-17 21:55:58
Pascal
Mors Clamor, 2017-05-17 21:55:58

Pascal problem, the answer is very different from the sample, what am I doing wrong?

There is a task: 4b65d8b421e2499eaa8b2ab1c54431e5.png
(the question mark is beta)
I'm trying to solve in pascal (console delphi)

program Project2;

{$APPTYPE CONSOLE}
uses
  SysUtils,
  Math;


var
  xn,i:integer;
  a,b,z,beta,y:real;
  arr:array of real;
begin
write('input quantity X: ');
readln(xn);
SetLength(arr,xn);
for i:=0 to High(arr) do arr[i]:=0;
for i:=0 to High(arr) do
begin
writeln('Input a,b,z,beta for x',i,': ');
write('a=');
readln(a);
write('b=');
readln(b);
write('z=');
readln(z);
write('beta=');
readln(beta);
arr[i]:=(z*z*z)-b+a*a/(Tan(2*beta)*Tan(2*beta));
end;
for i:=0 to High(arr) do y:=y+arr[i];
writeln('y=',y:3:2);
readln;
end.

The answer does not match the sample
9430083059cf4d1a8a79af27055b83e4
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question