Sunday, July 5, 2015

Powe of base

#include<stdio.h>

int poo( int,int);

int main()

{
    int add,power,base;
    printf("please enter base and power:");
    scanf("%d%d",&base,&power);

    add=poo(base,power);
    printf("the result is:%d",add);

    return 0;

}
int poo( int b,int p)
{
    int i,sum=1;
    for(i=1; i<=p; i++)
    {
        sum=sum*b;

    }

    return(sum);
}

No comments:

Post a Comment