Hi Ekox,
Try this code :
Program Math1;
Uses Wincrt;
Var i,n,A: integer;
x: real;
Begin
Writeln('Programe A^n');
Writeln('===================');
Writeln;
Write('Input n : ');readln(n);
Write('Input A : ');readln(A);
Writeln;
x:=1;
if (n>0) then
For i:= 1 to n do
x:=x*A
else if (n=0) then
x:=1
else
begin
n:=-1*n;
For i:= 1 to n do
begin
x:=x*(1/A);
end;
end;
Writeln('The Result of A^n is : ',x:6:2);
End.
Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444