
Patrick B. answered 07/12/19
Math and computer tutor/teacher
program MathCalculation (input,output);
Function Power ( x : real; n: integer ) : real;
Var iLoop : integer;
Var PowerReturn : Real;
Begin
PowerReturn := x;
for iLoop:= 1 to n-1 do
begin
PowerReturn := PowerReturn * x;
end;
Power := PowerReturn;
end;
{***********************************************************}
Function Factorial ( n : integer) : longint;
Begin
if (n=1) or (n=0) then
Factorial := 1
else
if (n=2) then
Factorial:=2
else Factorial := n * Factorial(n-1);
end;
{***********************************************************}
Function MathCalculation ( a,b: real; N : integer) : real;
begin
MathCalculation := (Power( (a/b), N)) / Factorial(n);
end;
{***********************************************************}
Var
a,b: real;
N : integer;
{***********************************************************}
Begin
{* uncomment these for input:
write(' Please input A :>'); readln(A);
repeat
write(' Please input B :> ');
readln(B);
until (B<>0);
repeat
write(' Please input N :>');
readln(N);
until (N>=0);
*}
{* comment this out if using input *}
a:=5; b:=10; N:=2; {* answer is 1/8 = 0.125 *}
writeln( MathCalculation(a,b,n) : 12 : 6);
End.