-->
当前位置:首页 > 题库

PROGRAMMING:Recursive calling of function

Luz5年前 (2021-05-10)题库526
There are n people sitting together. The nth person is 2 years older than the (n-1)th person, the (n-1)th person is 2 years older than the (n-2)th person, and so on. ...... The first person is 10 years old.How old is the nth person?
it is required using recursive function to caculate.
### Input Format:
Enter n to represent the nth person.
### Output Format:
Output the age of the nth person
### Sample Inputs:
```in
five
```
### Sample Output:
```out
the age of the 5th person is 18
```







answer:If there is no answer, please comment