很厉害的
发表于 2022-7-2 19:43:13
很厉害的
zxilonggs
发表于 2022-7-2 22:19:07
{:5_90:}
scott97
发表于 2022-7-3 04:14:40
1
Loser_YiMo
发表于 2022-7-3 12:33:12
1
Tengfly
发表于 2022-7-3 16:06:26
棒
治愈罗小黑
发表于 2022-7-4 23:48:35
{:5_109:}
1870054561
发表于 2022-7-5 16:38:11
666666
yjx20060525
发表于 2022-7-5 17:10:17
查看参考答案
liuupc919
发表于 2022-7-5 19:21:25
鱼C有你更精彩^_^
SaltY7967
发表于 2022-7-6 13:55:41
嗨嗨嗨
peng18186008
发表于 2022-7-6 14:11:09
1
从编程到植发
发表于 2022-7-7 04:29:36
aaaaaaaaaaaaaaaaaaaaaaaaaaaa
945939106
发表于 2022-7-7 17:13:03
1
完颜小白
发表于 2022-7-9 16:28:34
真想知道
XLACK
发表于 2022-7-9 22:46:57
#include <stdio.h>
int main()
{
int year=0;
double money1,money2=10000;
do
{
money1=10000*(1+(++year)*0.1);
money2=money2*(1+0.05);
}while(money1>=money2);
printf("%d年后,黑夜的投资额超过小甲鱼!\n",year);
printf("小甲鱼的投资额是:%.2f\n",money1);
printf("黑夜的投资额是:%.2f\n",money2);
return 0;
}
#include <stdio.h>
int main()
{
int money=400,year=0;
do
{
year++;
money-=50;
money=money*(1+0.08);
}while(money>0);
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗……\n",year);
return 0;
}
#include <stdio.h>
#include <math.h>
int main()
{
double pi=1,pi_bak;
int i=1,temp=3;
do
{
i=-i;
pi_bak=pi;
pi=pi+i*1.0/temp;
temp+=2;
}while(fabs(pi-pi_bak)>=1e-9);
printf("%.8f\n",pi*4);
return 0;
}
#include<stdio.h>
int main()
{
int month,num=2;
for(month=0;month<=24;month++)
num*=2;
printf("2年可与繁殖%d对兔子\n",num/2);
return 0;
}
totti
发表于 2022-7-10 22:34:26
hui
Theseaofstars
发表于 2022-7-11 21:51:18
本帖最后由 Theseaofstars 于 2022-7-11 22:00 编辑
0.10
1.0,第一次执行时条件为错,不执行循环直接结束。
2.a,b,c
3.a=14,b=5,c=9
4.z=x<0? -x:x;
5.
A
if(size>12)
{
cost=cost*1.05;
flag =2;
}else
{
bill = cost*flag;
}
B
if(ibex>14)
{
sheds=3;
}
else
{
sheds = 2;
}
help=2* sheds;
C
scanf("%d",&score);
while(score >=0)
{
count++;
scnaf("%d",&score);
}
printf("count = %d\n",count);
动动手
0.
#include<stdio.h>
int main()
{
int year=1;
float a=10000.0,b=10000.0;
while(1)
{
a+=10000*0.1;
b=b*(1+0.05);
if(b>a)
{
break;
}
year++;
}
printf("%d年后,黑夜的总投资额超过小甲鱼!\n",year);
printf("小甲鱼的投资额是:%.2f\n",a);
printf("黑夜的投资额是:%.2f\n",b);
return 0;
}
1.
#include<stdio.h>
int main()
{
double a = 4000000;
int i ;
for(i=0;a>=0;i++)
{
a=a-500000;
a=a*(1+0.08);
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n",i);
return 0;
}
2.
#include<stdio.h>
#include<math.h>
int main()
{
double Pi=0.0;
double n=1.0;
int i,j=0;
for(i=3;fabs(n)>0.00000001;i+=2)
{
Pi+=n;
n=pow(-1,++j)*1/i;
}
printf("%.7lf",Pi*4);
return 0;
}
3.
#include<stdio.h>
int main()
{
int a =1,b=1,c=1;
int sum =0;
int i=0;
for(i=3;i<=24;i++)
{
sum=a+b+c;
a=a+c;
c=b;
b=a;
}
printf("总共有%d对兔子\n",sum);
return 0;
}
moonbyul
发表于 2022-7-12 10:54:57
check
Asuperbear
发表于 2022-7-12 22:13:29
那你
496339041
发表于 2022-7-12 23:32:47
测试题
0. 10
1.10
2.a,b,c
3.b=5,c=9,a=14
4.z=x>=0?x:-x
5.A:
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
B:
if (ibex > 14)
{
sheds = 3;
}
else{
sheds = 2;
help = 2 * sheds;
}
C:
if (score < 0)
{
printf("count = %d\n", count);
}
else{
count++;
scanf("%d", &score);
}
动动手:
0.
#include <stdio.h>
int main(){
float moneyA = 10000.0,moneyB = 10000.0; //本金
float sMoneyA = 10000.0;//A的总钱数
int year = 0;
while (moneyB <= sMoneyA)
{
sMoneyA = moneyA*0.1 + sMoneyA;
moneyB = moneyB + moneyB*0.05;
year++;
}
printf("%d年后,黑夜的投资额超过小甲鱼\n",year);
printf("小甲鱼的投资额是%.2f\n黑夜的投资额是%.2f\n",sMoneyA,moneyB);
}
1.
#include <stdio.h>
int main(){
float money = 4000000.0;
int year = 0;
while (money >= 0)
{
money = money - 500000.0;
money = money * 1.08;
year++;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗...",year);
return 0;
}
2.
#include <stdio.h>
#include <math.h>
int main(){
long double pai1_4 = 0.0; // 1/4pi
long double i = 1.0; // 第几项
long double num = 1.0; // 该项的值
while (num >= ((long double)pow(10,-8)))
{
if (((int)i)%2 == 1)
{
pai1_4 = pai1_4 + num;
}
else{
pai1_4 = pai1_4 - num;
}
i++;
num = 1.0/(2.0*i-1.0);
}
printf("pi为%.7llf",4.0*pai1_4);
}
不知道为啥输出不了正确结果
3.