|
发表于 2024-3-29 22:06:43
|
显示全部楼层
0.10个'A'
1.0个'B'
2.a,b,c
3.
14 5 9
4.
5.
- if (size > 12)
- {
- cost = cost * 1.05;
- flag = 2;
- }
- bill = cost * flag;
复制代码
- if (ibex > 14)
- {
- sheds = 3;
- }
- sheds = 2;
- help = 2 * sheds;
复制代码
- if (score < 0)
- {
- printf("count = %d\n", count);
- }
- count++;
- scanf("%d", &score);
复制代码
0.
- #define _CRT_SECURE_NO_WARNINGS 1
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int i = 1;
- float xjy, hy;
- xjy = hy = 10000;
- xjy += 0.1 * xjy;
- hy += 0.05 * hy;
- while (xjy > hy)
- {
- i++;
- xjy += 1000;
- hy += 0.05 * hy;
- }
- printf("%d年后,黑夜的投资额超过小甲鱼!\n",i);
- printf("小甲鱼的投资额是:%.2f\n", xjy);
- printf("黑夜的投资额是:%.2f\n", hy);
- return 0;
- }
复制代码
1.
- #define _CRT_SECURE_NO_WARNINGS 1
- #include <stdio.h>
- int main()
- {
- int i=1;
- float money;
- money = (400 - 50) * (1 + 0.08);
- while (money >= 0)
- {
- i++;
- money = (money - 50) * (1 + 0.08);
- }
- printf("%d年后,小甲鱼败光所有家产,再次回到一贫如洗......", i);
- return 0;
- }
复制代码
2.
- #define _CRT_SECURE_NOO_WARNINGS 1
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- double pai,tmp;
- int i, j;
- i = j = 1;
- tmp = 1 / i;
- pai = tmp;
- while (fabs(tmp) >= pow(10, -8))
- {
- pai += tmp;
- i = -i;
- j += 2;
- tmp = i / (j*1.0);
-
- }
- printf("π的近似值为:%.7f", pai*4);
- return 0;
- }
复制代码
3.斐波那契数列?
- #define _CRT_SECURE_NO_WARNINGS 1
- #include <stdio.h>
- int Fib(int n)
- {
- if (n == 1 || n == 2)
- {
- return 1;
- }
- else
- {
- return Fib(n - 1) + Fib(n - 2);
- }
- }
- int main()
- {
- long int num;
- num = Fib(24);
- printf("两年后可以繁殖%ld对兔子", num);
- return 0;
- }
复制代码
|
|