#include <stdio.h>
int power(int m, int e);
int main(void)
{
int m, e;
m = 3;
e = 4;
printf("%d to the %d is %d\n", m, e, power(m, e));
printf("5 to the 6th is %d\n", power(5, 6));
printf("4 to the 4rd is %d\n", power(4, 4));
return 0;
}
/* Parameterized version of power. */
int power(int m, int e)
{
int temp;
temp = 1;
for( ; e > 0; e--)
temp = temp * m;
return temp;
}
|