参考代码:
int n;
float child = 2.0, mother = 1.0;
float sum;
scanf("%d", &n);
for(int i = 1; i <= n; i++) {
sum += child / mother;
int temp = child;
child += mother;
mother = temp;
}
printf("%.2f",sum);
return 0;
0.0分
0 人评分
点我有惊喜!你懂得!浏览:1544 |
点我有惊喜!你懂得!浏览:4138 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:972 |
简单编码 (C++代码)浏览:722 |
简单的a+b (C语言代码)浏览:778 |
C语言训练-列出最简真分数序列* (C语言代码)浏览:537 |
C语言程序设计教程(第三版)课后习题9.1 (Java代码)浏览:477 |
矩阵乘法 (C++代码)浏览:1646 |
字符串比较 (C语言代码)答案错误????浏览:629 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:587 |