#include <stdio.h>
int fac(int n,int k)
{
if(k == 0 || n == 1)
return 1;
else
return n* fac(n, k - 1);
}
int main()
{
int a, b;
printf("请输入n和k\n");
scanf("%d %d",&a,&b);
printf("%d\n",fac(a,b));
return 0;
}
递归实现n^k
最新推荐文章于 2022-04-12 16:33:04 发布