answersLogoWhite

0

1) Write a loop to multiply "x" by itself, "n" times.

2) Use recursion. If your function is called "myPower", then if the exponent is 1, return "x". Otherwise return myPower(x, n - 1).

3) But in general, and especially if you want to calculate non-integral powers, it's best to use the functions already included in the C language.

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

C plus plus program calculate the power value of input base and exponent numbers?

cn = c0 *( 1 + i ) pow n


Formula of power in c program?

There is a function called pow in header math.h


Write a c program for creating a virus?

a c program for creat a virus


Recursive program for a power b in c language?

int pow (int a, int b) { if (b==0) return 1; else return a*pow(a,b-1); }


Where do we write main function in a c program?

Into the source program.


How do you write a program in c to compute the power of a number without using the mathh library?

There is a function which can do it for you. You have to include math.h in headers. And then use the function pow(x, y) which returns a value of type double (x and y are double too).pow(x, y) = x to the power of y.


Write a c program to find Volume and surface area of cube?

Write a c program to compute the surface area and volume of a cube


How do you write a c program to analysis a circuit?

There is no need to write a C program for circuit analysis; there are lots of packages out there that already do that (for example, Spice).


How do you write a C program to check whether the number is odd or even Ps-using DEV complier?

To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.


How do you write socket program in c?

For first find an example program.


How do you write a program in embedded c?

Use a text-editor program.


How do you write an Algorithm for a C plus plus Program?

You don't write an algorithm for a C++ program, unless you are documenting the C++ program after-the-fact. The normal procedure is to write the algorithm first, in a language independent fashion, and then translate that stated algorithm into C++ code, or into whatever language you wish.