Posted on 2007-07-01 00:10
停留的风 阅读(2305)
评论(1) 编辑 收藏 所属分类:
C语言学习历程
#include <stdio.h>
long int x_to_the_n(int i,int n)
{
long int result=1;
for(int j=1;j<=n;j++)
{
result*=i;
}
return result;
}
int main(void)
{
int num1,num2;
printf("Enter two numbers !\n");
scanf("%i",&num1);
scanf("%i",&num2);
long int result=x_to_the_n(num1,num2);
printf("%i的%i次方 is %li.\n",num1,num2,result);
return 0;
}
运行图: