#include
int getAge(int n){ int age5; if(n==1) age5 = 10; else age5 = getAge(n-1)+2; return age5; } int mian() { int age = getAge(5); printf("第5个人的年龄是:",age); return 0; }第一行改成int getAge(n)去掉括号里面的int
int getAge(int n)
{
int age5;
if(n==1)
age5 = 10;
else
age5 = getAge(n-1)+2;
return age5;
}
int main()
{
int age = getAge(5);
printf("第5个人的年龄是:%d",age);
return 0;
}