0
0
0.无限,j!=10永远成立
1.0
2.a,b,c
3.14,5,9
4.z = x >= 0 ? x : -1 * x;
5.A
if (size > 12)
{
cost *= 1.05;
flag = 2;
}
else
{
bill = cost * flag;
}
B
if (ibex > 14)
{
sheds = 3;
}
else
{
sheds = 2;
help = 2 * sheds;
}
C
while (score < 0)
{
count++;
scanf("%d", &score);
}
printf("count = %d\n", count);
0.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main()
{
int i = 0;
double a = 10000, b = 10000;
while (a >= b)
{
a = a + 10000 * 0.1;
b = b * 1.05;
i++;
}
printf("%d年后,黑夜的投资总额超过小甲鱼!\n",i);
printf("小甲鱼的投资额是:%.2lf\n", a);
printf("黑夜的投资额是:%.2lf\n", b);
return 0;
}
2.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main()
{
double Pi=0, i=1, j=1;
while (fabs(1 / i) > pow(10, -8))
{
Pi += 1/i*j;
j *= -1;
i = i + 2;
}
Pi *= 4;
printf("Pi的近似值为%.7lf", Pi);
return 0;
}
3.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main()
{
int lr1 = 1, lr2=0, br = 0;
for (int t = 0;t <= 24;t++)
{
br += lr2;
lr2 = 0;
lr2 += lr1;
lr1 = 0;
lr1 = br;
}
printf("两年后可以繁殖%d对兔子", lr1 + lr2 + br);
return 0;
}
。/
、、
81
11
abc
a=14 b=5 c=9
z = (x >= 0) ? x : -x;
--------------------
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
--------------------
if (ibex > 14)
{
sheds = 3;
}
else{
sheds = 2;
}
help = 2 * sheds;
--------------------
while (1) {
scanf("%d", &score);
if (score < 0) break;
count++;
}
printf("count = %d\n", count);
--------------------
float turtle=10000,dark=10000;int count=0;
do{
turtle=turtle+10000*0.1;
dark=dark+dark*0.05;
count=count+1;
}
while(turtle>=dark);
printf("%d %.2f %.2f",count,turtle,dark);
-------------------------
int main() {
float turtle = 4000000;int count = 0;
do {
turtle = (turtle - 500000)*1.08;
count = count + 1;
} while (turtle > 0);
printf("%d %.2f", count, turtle);
}
------------------------------
int main() {
long double a = 0;
long double add;
int n = 1 ;long double signal = 1;
do {
add = signal/(2*n-1);
a = a + add;
n++;
signal = -signal;
}
while (fabs(add)>1e-8);
printf("%.7f", 4*a);
}
---------------------------------
#include<stdio.h>
int main() {
int birthable = 0, all = 2, month = 0, young0 = 2,young1=0;
while (month<24) {
month++;
all = all + birthable / 2 * 2;
birthable = birthable + young1;
young1 = young0;
int new_born = birthable;
young0 = new_born;
}
printf("%d", all);
}
0.10
1.10
2.a,b,c
3.3,9,12
4.z=x>0?x:-x
5.A
if(size>12)
{
cost=cost*1.05;
flag=2;
}
bill=cost*flag
C
while(1){
scanf("%d",&score);
if(score<0){
printf("count=%d",count);
}
count++;
0.
#include <stdio.h>
int main()
{
int year=0, inte_x=10000,inte_h=10000;
while(inte_x>=inte_h)
{
inte_x+=10000*0.1;
inte_h*=1.05;
year++;
}
printf("%d年后,黑夜投资额超过小甲鱼!\n",year);
return 0;
}
1.
#include <stdio.h>
int main()
{
int year=0,cash=400;
while(cash>0)
{
cash-=50;
cash*=1.08;
year++;
}
printf("%d年后,小甲鱼再次一贫如洗...\n",year);
return 0;
}
2.
#include <stdio.h>
int main()
{
int i=-1;
double re=0,num=1.0;
while(1.0/num>0.0000000001)
{
i*=-1;
re+=i/num;
num+=2;
}
printf("pi=%.9f\n",re*4);
return 0;
}
3.
#include <stdio.h>
int main()
{
int num=1,month=0,repro=0,month1=1,month2=0;
while(month<=24)
{
num+=repro;
month2=month1;
repro=num-month1-month2;
month1=repro;
month++;
}
printf("两年后,%d对兔子\n",num);
return 0;
}
1
100个A
11
a,b,c
a=14 b=5 c=9
z=x>=0? x:-x
if (size > 12)
{cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
#include<stdio.h>
#include<math.h>
int main (){
long double fourpi=0;
int k=1;
int sign=1;
long double num=1;
while (fabs(num)>=(1e-8)){
num=1.0L/(sign*k);
fourpi+=num;
k+=2;
sign=-sign;
}
printf("Pi近似值为%.7Lf",4*fourpi);
return 0;
}
while (score)<=0{
count++
scanf(.....)}
printf(.....)
1
s'd
1
{:5_101:}
0100个A
111个B
2abc都是左值
3459
4
if (size > 12) { cost = cost * 1.05; flag = 2; }
bill = cost * flag;
if (ibex > 14){ sheds = 3; }
else { sheds = 2; }
help = 2 * sheds;
scanf("%d", &score);
for(; !(score < 0), count++)
{ scanf("%d", &score);}
printf("count = %d\n", count);