Abaduaber

POLANN_3

Dec 6th, 2012
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.55 KB | None | 0 0
  1. Var
  2.     X: Array [1..25] Of LongInt;
  3.     Y: Real; I: Integer;
  4.  
  5. Function CalcLevel(ALev: Integer): Real;
  6. Var
  7.     Z: Real; I, S: Integer;
  8. Begin
  9.     S:= -1;
  10.     Z:= X[25];
  11.     For I:= 24 DownTo ALev Do Begin
  12.         Z:= Z + X[I] * S;
  13.         S:= -S;
  14.     End;
  15.     CalcLevel:= Z;
  16. End;
  17.  
  18. Begin
  19.     WriteLn('Введите массив X:');
  20.     For I:= 1 To 25 Do Begin
  21.         Write('X[', I, '] = ');
  22.         ReadLn(X[I]);
  23.     End;
  24.     Y:= X[25] * 25;
  25.     For I:= 24 DownTo 1 Do Y:= Y * CalcLevel(I);
  26.     WriteLn('Y = ', Y);
  27.     ReadLn;
  28. End.
Advertisement
Add Comment
Please, Sign In to add comment