C语言简单递归 题目要求: 代码实现:12345678910111213141516171819202122#include<stdio.h>/* 懵逼了下,去看了下别人的题解调试了下函数,终于理解了 这题递归其实就是到function(1)的时候 就是x变成了数字了 比如function(3) = function(2)+2 = function(1)+2+2; function(3) = 14*/int function(int x) { if (x == 1) { return 10; } else if (x > 1) { return function(x - 1) + 2; }}int main() { int x; scanf("%d", &x); printf("%d", function(x));} #C C语言简单递归 http://example.com/2023/08/28/C语言简单递归/ Author fwlw Posted on August 28, 2023 Licensed under C语言百钱百鸡 Previous C语言大小写转换问题 Next