f(k,n)=1^k+2^k+...+n^k
下面程序用于求f(k,n)=1^k+2^k+...+n^k,其中k,n用键盘输入,函数power(m,n)求m^k,函数sum_power(k,n)求f(k,n),试在程序中划线部分填上适当的内容。#include<stdio.h>
long power(int m, int n)
{int i;
_________________;
for (i=1;i<=n;i++)
_________________;
return p;
}
long sum_power(int k, int n)
{int i;
___________________;
for (i=1;i<=n;i++)
___________________;
return sum;
}
main()
{int k,n;
scanf("%d%d",&k,&n);
printf("f(%d,%d)=%ld\n",k,n,sum_power(k,n));
}