: I'm hoping someone might be able to help me with the following

: problem. I need a way of raising a given number (Total) to a given

: exponent (Power) without using the POW function. I've tried the

: following loop with success:

: while(Count < Power)

: {

: Total = Total * Total;

: Count = Count + 1;

: }

: where Total is type float and Count and Power are integers. Am I

: missing something obvious? Any help is appreciated.

#include <stdio.h>

#include <stdlib.h>

int main(int argc, char *argv[])

{

int count = 0;

double number = 0, answer = 1;

if (argc > 1)

number = atof(argv[1]);

if (argc > 2)

count = atoi(argv[2]);

while (count--)

answer *= number;

printf("The answer was %f\n", answer);

return 0;

Quote:

}

and then think about boundary conditions; overflow, underflow, negative

arguments, and so on. And some error checking as well.

Will