本帖最后由 jackz007 于 2021-12-5 20:55 编辑
#include <stdio.h>
unsigned long long powerx(unsigned long long a , unsigned long long b)
{
return (b > 0) ? a * powerx(a , b - 1) : 1 ;
}
int main(void)
{
unsigned long long a , b ;
scanf("%I64u%I64u" , & a , & b) ;
printf("%I64u ^ %I64u = %I64u\n" , a , b , powerx(a , b)) ;
}
编译、运行实况:D:\00.Excise\C>g++ -o x x.c
D:\00.Excise\C>x
2 5
2 ^ 5 = 32
D:\00.Excise\C>x
12 0
12 ^ 0 = 1
D:\00.Excise\C>x
4 1
4 ^ 1 = 4
D:\00.Excise\C>x
2 3
2 ^ 3 = 8
D:\00.Excise\C>x
4 6
4 ^ 6 = 4096
D:\00.Excise\C>x
5 6
5 ^ 6 = 15625
D:\00.Excise\C>x
4 4
4 ^ 4 = 256
D:\00.Excise\C>
|