感谢分享
{:10_277:}
小甲鱼
#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:}