Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- x, n: Integer;
- y: Real;
- function GetNum(hint: string): Integer;
- var
- Tmp: string;
- ErrorCode, Res: Integer;
- begin
- repeat
- Write(hint);
- ReadLn(Tmp);
- Val(Tmp, Res, ErrorCode);
- if ErrorCode > 0 then
- WriteLn(Copy(Tmp, 1, ErrorCode - 1), '->', Tmp[ErrorCode], '<-', Copy(Tmp, ErrorCode + 1, Length(Tmp) - ErrorCode));
- until ErrorCode = 0;
- GetNum := Res;
- end;
- function f(const x0, MaxN, CurrentStage: Integer): Real;
- var
- Res: Real;
- begin
- Res := Cos(Exp(CurrentStage * Ln(x0)));
- if CurrentStage < MaxN then
- Res := Res + f(x0, MaxN, CurrentStage + 1);
- f := Res;
- end;
- begin
- x := GetNum('Vvedite nachalnoe znachenie argumenta: ');
- n := GetNum('Vvedite maksimalnoe znachenie stepeni: ');
- y := f(x, n, 1);
- WriteLn('y=',y:5:2);
- ReadLn;
- end.
Add Comment
Please, Sign In to add comment