这个输出为什么是8呀
#include <stdio.h>
int getAge(numPeople)
{
int age;
if (numPeople==1)
{
age=10;
}
else
{
age= getAge(numPeople-1)+2;
return age;
}
}
int main()
{
int fifithAge=getAge(5);
printf("第5个人的年龄是%d岁", fifithAge);
return 0;
}
#include <stdio.h>
int getAge(numPeople)
{
int age;
if (numPeople==1)
{
age=10;
}
else
{
age= getAge(numPeople-1)+2;
return age;
}
}
int main()
{
int fifithAge=getAge(5);
printf("第5个人的年龄是%d岁", fifithAge);
return 0;
}
2019-03-13
举报