A book I was reading suggested I write a recursive function that calculated a power of a number. Here’s my attempt – comments and suggestions welcome:
double powerup( double num, double powr) { if ( powr < 0 || num < 0 ) return 0; if ( powr == 1 ) return num; powr--; return num * powerup(num, powr); }