program ExponentialFunction;
varx, result: real;i, fact: integer;
function Factorial(n: integer): integer;beginif n = 0 thenFactorial := 1elseFactorial := n * Factorial(n-1);end;
beginwrite('Enter the value of x: ');readln(x);
result := 0;
for i := 0 to 10 dobeginfact := Factorial(i);result := result + power(x, i) / fact;end;
writeln('e^', x, ' = ', result:0:4);end.
program ExponentialFunction;
var
x, result: real;
i, fact: integer;
function Factorial(n: integer): integer;
begin
if n = 0 then
Factorial := 1
else
Factorial := n * Factorial(n-1);
end;
begin
write('Enter the value of x: ');
readln(x);
result := 0;
for i := 0 to 10 do
begin
fact := Factorial(i);
result := result + power(x, i) / fact;
end;
writeln('e^', x, ' = ', result:0:4);
end.