#include <stdio.h>
int main(){
int count = 0;
double a, b;
a = b = 10000;
do{
a += 0.1*10000;
b *= 1.05;
count++;
}while(a>=b);
printf("After %d years,heiye will have more money than xiaojiayu.\n", count);
printf("xiaojiayu's money: %.2lf\n", a);
printf("heiye's money: %.2lf\n", b);
return 0;
}
#include <stdio.h>
int main(){
int count = 0;
float money = 400;
do{
money -= 50;
money *= 1.08;
count++;
}while(money>0);
printf("After %d years,xiaojiayu becomes poor again!\n", count);
return 0;
}
#include <stdio.h>
#include <math.h>
int main(){
double pi = 0, temp, i = 1.0;
do{
temp = (int)i%4==1?1/i:-1/i;
pi += temp;
i += 2;
}while(fabs(temp)>=pow(10, -8));
pi *= 4;
printf("%.7lf\n", pi);
return 0;
}
#include <stdio.h>
int main(){
int a;
a = a = 1;
for(int i = 2; i<24; i++){
a = a + a;
}
printf("After 2 years,there'll be %d pairs of rabbits.\n", a);
return 0;
}
1
打卡打卡
小甲鱼goto语句那里是不是搞错了呀,goto语句不是跳转到标签后就从标签开始顺序执行吗
#include <stdio.h>
int main(void)
{
int size;
int cost = 1, flag = 1, bill = 1;
scanf("%d", &size);
if (size > 12)
{
goto a;
printf("OOKK!\n");
}
printf("here!\n");
goto b;
a:cost = cost * 1.05;
flag = 2;
b:bill = cost * flag;
}
lllhc11 发表于 2019-7-21 11:07
小甲鱼goto语句那里是不是搞错了呀,goto语句不是跳转到标签后就从标签开始顺序执行吗
#include
我输入13的话,他是什么都不打印欸
看看
加油
1
看看
a
作者吱吱吱吱吱吱吱吱
lgpmynpy
实测为
{:5_90:}
答案
0、90个
1、10个
2、a,b,c
3、a=14,b=4,c=10
4、x=-x?z:
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、
if (score < 0)
{
printf("count = %d\n", count);
}
else
{
count++;
scanf("%d", &score);
}
0、#include<stdio.h>
int main()
{
float i=10000,j=10000;
int count=0;
while(i<=j)
{
i=i*0.05+i;
j=10000*0.1+j;
count++;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n",count);
printf("小甲鱼的投资额是:%.2f\n",j);
printf("黑夜的投资额是:%.2f\n",i);
return 0;
}
1、#include<stdio.h>
int main()
{
float i=4000000;
int count=0;
while(i>0)
{
i=(i-500000)*1.08;
count++;
}
printf("%d年之后,黑小甲鱼败光了所有的家产,再次回到一贫如洗......\n",count);
return 0;
}
2、#include<stdio.h>
#include<math.h>
int main()
{
double Pi=2,i=1,j=1;
while(fabs(i)<pow(10,-8))
{
i=1/j;
i=-i;
Pi=Pi+i;
j=j+2;
}
printf("Pi的近似值为:%.7f",4*Pi);
return 0;
}
3、#include<stdio.h>
#include<math.h>
int main()
{
long long count=2;
count=pow(2,32);
printf("共有%llu对兔子\n",count);
return 0;
}
100,0,a,14