📄 ex22.c
字号:
#include <stdio.h>
main() { /* 主函数体 */
int x, n, p, power(int x, int n);
printf("caculate X to the power of N\n please input X and N ? ");
scanf("%d%d",&x,&n);
p = power(x,n); /* 在此处调用函数 */
printf("%d to the power of %d = %d\n",x,n,p);
while(1);
}
int power(int x,int n) /* 被调用函数 */
int x, n;
{
int i, p = 1;
for( i=0; i<n; ++i ) p *= x;
return( p ); /* 带值返回到调用处 */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -