10
0
a,b,c
14 5 9
z = x > -x ? x : -x
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
break;
}
else
{
bill = cost * flag;
}
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
while (scanf("%d", &score))
{
if (score < 0)
{
printf("count = %d\n", count);
break;
}
count++;
}
0.#include <stdio.h>
int main()
{
float a = 10000, b = 10000;
int count = 0;
while (a >= b)
{
count++;
a += 10000 * 0.1;
b *= 1.05;
}
printf("%d年后,黑夜的投资超过了小甲鱼!\n黑夜的投资额是%.2f\n小甲鱼的投资额是%.2f\n", count, b, a);
}
1.#include <stdio.h>
int main()
{
float money = 400;
int year = 0;
while (money > 0)
{
year++;
money -= 50;
money *= 1.08;
}
printf("%d年后,小甲鱼又变得一贫如洗!\n", year);
}
2.#include <stdio.h>
#include <math.h>
int main()
{
double i = 3.0;
double num = 1.0;
int count = 1;
int max = pow(10, 8);
while (fabs(i) <= max)
{
if (count%2)
{
num += (1.0/-i);
}
else
{
num += (1.0/i);
}
i += 2.0;
count++;
}
printf("%.8f", num * 4);
}
3.#include <stdio.h>
int main()
{
int m1 = 2, m2 = 0, m = 0;
int count1, count2, count;
int mon;
m1 = 2;
for (mon = 0; mon < 24; mon++)
{
count1 = m1;
count2 = m2;
count = m;
m2 += count1;
m += count2;
m1 += count;
m2 -= count2;
m1 -= count1;
}
printf("总共有%d只兔子\n", m1+m2+m);
}
|