Home > Back-end >  The newborn is not
The newborn is not

Time:09-21

College students how to use c # non-recursive method to calculate the NTH power of x?
Thanks for your homework in the afternoon will be handed over

CodePudding user response:

It is good to use cycle the
Sum=1;
for(int i=0; iSum=sum * x;

CodePudding user response:

The
reference 1/f, Simple, Soft reply:
with circulation good
Sum=1;
for(int i=0; iSum=sum * x;

Cycle is recursive?

CodePudding user response:

refer to the second floor tianyabaiwei response:
Quote: reference 1/f, Simple, Soft reply:
with circulation good
Sum=1;
for(int i=0; iSum=sum * x;

Cycle is recursive?

Not
The recursive and different cycle

CodePudding user response:

Write a class C algorithm, you see
If the critical judgment statements may not right, a little change,
 
Float fun (float x, int n)
{
If (n> 0)
Result=x * fun (x, n - 1);

The return;
}
  • Related