954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

square number (n^n)

hi,
i try to make a square number but its not limited by 2. number and the square can be any numbers. so its like n^n.
please help me..
i confused how to do this..

any help will be appreciated.

thanks.

EkoX
Newbie Poster
18 posts since Aug 2008
Reputation Points: 28
Solved Threads: 1
 

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
 

thank you so much jx..
this what a looking for..

thank you a million..

EkoX
Newbie Poster
18 posts since Aug 2008
Reputation Points: 28
Solved Threads: 1
 

Math.Power(N,M)

Wolfgan
Junior Poster
101 posts since Jun 2010
Reputation Points: 34
Solved Threads: 14
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: