To design a program that works out the powers of numbers. For example
3^5 = 3*3*3*3*3 = 243
2^3 = 2*2*2 = 8

Show what you have so far.

Hi turbomen!
I have an idea in pascal :)

``````{
To design a program that works out the powers of numbers. For example
3^5 = 3*3*3*3*3 = 243
2^3 = 2*2*2 = 8
}
Program Program01;
Uses Crt;
Var i:Byte;
a,b,c:LongInt;
word01:String[1];{it can be char too}
Begin {Main}
word01:='*';
{first number}
ClrScr;
Write(a,'^');
{how many times}
ClrScr;
{write the reults}
Write(a,'^',b,' = ');
c:=a;
For i:=1 To b Do
Begin
Write(c);
If (i=b) Then
Begin
Write(' = ',a);
Break;
End
Else Write(word01);
a:=a*c;
End;
End.{end main}

{
-= Note By FlamingClaw =-
Created and tested in Dev Pascal!Working!
-= Created By FlamingClaw =-
-=2009.03.25=-
}``````
commented: He help me a lot. +1

Delphi has a function called Power that does this.

Are you interested in only working with integers?

You could always do something like

for i:=0 to n do X:=X*X;
Write(IntToStr(X));

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.