Saturday, 7 September 2013

Calculate Power

#include<stdio.h>
#include<conio.h>
int calculatepower(int base,int exponent)
{
int p=1,a;
for(a=1;a<=exponent;a++)
{
p=p*base;
}
return p;
}
main()
{
int p;
p=calculatepower(3,4);
printf("power=%d",p);
getch();
}

No comments:

Post a Comment