0.
10次
1.
0次
2.
a
3.
a = 9
b = 4
c = 5
4.
5.
A:if (size > 15)
{
cost = cost + 1.05;
flag = 2;
}
else
{
bill = cost * flag;
}
B:if (ibex > 14)
{
sheds = 3;
}
else
{
sheds = 2;
help = 2 * sheds;
}
C:while (1)
{
scanf("%d",&score);
if (score < 0)
{
printf("count = %d\n",count);
break;
}
else
{
count++;
continue;
}
}
0.#include <stdio.h>
int main ()
{
int year = 0;
double ic = 10000.0,heiye = 10000.0,jiayu = 10000.0;
do
{
year++;
jiayu = jiayu + (ic * 0.1);
heiye = heiye + (heiye * 0.05);
}while (jiayu > heiye);
printf("%d年后,黑夜的投资额超过小甲鱼!\n小甲鱼的投资额是:%.2f\n黑夜的投资额是:%.2f",year,jiayu,heiye);
return 0;
}
1.#include <stdio.h>
int main ()
{
int year = 0;
float money = 400.0;
do
{
year++;
money = (money - 50)*(1 + 0.08);
}while (money > 0);
printf("%d年之后,小甲鱼败光了所有的家产,再次回到了一贫如洗.....",year);
return 0;
}
2.#include <stdio.h>
#include <math.h>
int main()
{
int count = 0;
double result = 0.0,i,a = 1.0,b = 1.0;
while (1)
{
i = a / b;
if (fabs(i) >= pow(10,-8))
{
if (!(count % 2))
{
result += i;
}
else
{
result -= i;
}
b += 2.0;
}
else
{
if (!(count % 2))
{
result += i;
}
else
{
result -= i;
}
printf("%.7f",result *= 4.0);
break;
}
count++;
}
return 0;
}
3.#include <stdio.h>
int main ()
{
int parent = 1,children = 0,count = 0,time = 24;
long result;
while (time)
{
children += parent;
if (count == 2)
{
parent += children;
count = 0;
}
count++;
time--;
}
result = (parent + children)*2;
printf("%d",result);
return 0;
}
|