#include <stdio.h>
int three_power(int power);
int main(){
int a=4;
int b=9;
printf("\n3 to the power of %d is %d", a, three_power(a));
printf("\n3 to the power of %d is %d", b, three_power(b));
return 0;
}
int three_power(int power){
if (power < 1){
return( 1 );
} else
return (3* three_power(power-1)); //This line
}
return
不是一个函数,而是一个语句。你不应该在结果周围添加括号。它们不是语句的一部分,而是表达式,也是不必要的。 - too honest for this site