这题怎么用while循环做?
这题怎么用while语句做?
去掉do,将while哪一行提到do那一行,去掉最后大括号的分号即可 #include <stdio.h>
#define MONEY 10000
int main(void)
{
double j = MONEY, h = MONEY;
int x = 1, count = 0;
while (x)
{
j += MONEY * 0.1;
h += h * 0.05;
count++;
if (j >= h)
{
x = 1;
}
else
{
x = 0;
}
}
printf("%d年\n", count);
printf("甲鱼:%.2f\n", j);
printf("黑夜:%.2f\n", h);
return 0;
} wyr190615 发表于 2018-12-27 10:07
#include
#define MONEY 10000
int main(void)
自己想出来了{:10_332:}
页:
[1]