题目内容
【7-4】对比(1)和(2)的子函数功能,讨论二者有何不同。(1)#include int main(){int p(int x,int n);int x=2,n=4;printf("p=%d\n",p(x,n));return 0;}int p(int x,int n){inti ,f=1;for(i=0;i#includelong power(int m,int n){if(n==0) return 1;if(n==1) return m;if(n>1) return m*power(m,n-1);}int main(){int m,n;long p;printf("input m:");scanf("%d",&m);printf("input n:");scanf("%d",&n);p=m*power(m,n-1);printf("\np=%ld,power=%%.0lf\n",p,pow(m,n));return 0;}
查看答案
搜索结果不匹配?点我反馈
更多问题