下面的资料是关于C语言递归解决年龄计算问题的代码,应该是对各位朋友也有好处。
#include “stdio.h”
#include “conio.h”
age(n)
int n;
{
int c;
if(n==1) c=10;
else c=age(n-1)+2;
return©;
}
main()
{
printf("%d",age(5));
getch();
}
下面的资料是关于C语言递归解决年龄计算问题的代码,应该是对各位朋友也有好处。
#include “stdio.h”
#include “conio.h”
age(n)
int n;
{
int c;
if(n==1) c=10;
else c=age(n-1)+2;
return©;
}
main()
{
printf("%d",age(5));
getch();
}