花椒壹拾伍
发表于 2019-2-9 23:29:48
本帖最后由 花椒壹拾伍 于 2019-2-10 14:21 编辑
:0:10个A。
1:0个。
2:abc
3:b=3
c=3+5=8,b=4
a=8+4=13,b=5,c=9
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:
scanf("%d", &score);
while (score >= 0)
{
count++;
scanf("%d", &score);
}
printf("count = %d\n", count);
动动手0:
#include <stdio.h>
#include <math.h>
int main()
{
float a,b;
int year;
year = 1;
a = 10000 + 1000* year;
b = 10000 * pow(1.05 , year);
while ( a > b)
{
year = year +1;
a = 10000 + 1000* year;
b = 10000 * pow(1.05 , year);
}
printf("%d年后,黑夜的投资额超过了小甲鱼!\n",year);
printf("小甲鱼的投资额是:%.2f\n",a);
printf("黑夜的投资额是:%.2f",b);
return 0;
}
动动手1:
#include <stdio.h>
int main()
{
float total , year;
total = 4000000;
year = 0;
while( total >= 0)
{
total = total - 500000;
total = total * 1.08;
year = year + 1;
}
printf("%.f年后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n",year);
return 0;
}
动动手2:
#include <stdio.h>
#include <math.h>
int main()
{
int sign = 1;//正负符号
double pi , fm , dq;//fm为分母,dq为当前项的值
pi = 0 ; fm = 1; dq = 1;
while ( fabs(dq) >= pow(10,-8) )
{
pi = pi + dq ;
fm = fm + 2;
sign = -sign;
dq = sign / fm;
}
pi = pi * 4 ;
printf("%.7f",pi);
return 0;
}
动动手3:
#include <stdio.h>
int main()
{
long a = 1, b = 1, c, i;
for (i = 3; i <= 24; i++)
{
c = a + b;
a = b;
b = c;
}
printf("两年后,总共有%ld只兔子!\n", c);
return 0;
}
Razr丶锋芒
发表于 2019-2-10 09:01:46
123
九少
发表于 2019-2-10 14:22:47
1
cc84525145
发表于 2019-2-11 21:57:43
杀杀杀
Wangzy1025
发表于 2019-2-12 09:50:22
#include <stdio.h>
#include <math.h>
int main() {
double sum = 0, i;
for (i = 1; 1 / (2 * i - 1) > pow(10, -8); i++) {
if ((long)i % 2) {
sum += 1 / (2 * i - 1);
} else {
sum += 1 / (1 - 2 * i);
}
}
printf("圆周率的七位小数为%.7f\n", sum * 4);
return 0;
}
梦开始的地方01
发表于 2019-2-12 11:26:53
-1
2316829671
发表于 2019-2-12 20:35:42
{:5_109:}
稚心语
发表于 2019-2-15 11:07:09
加油!
未来的中国首富
发表于 2019-2-16 15:31:53
0.100
1.10
2.a
3.c=10b=6a=16
4.z=x*x/x
5.if(size > 12)
{
cost=cost*1.05;
}
else
{
}
不存在的人
发表于 2019-2-16 17:05:28
缓慢跟上
njnf66
发表于 2019-2-16 17:27:44
喵喵喵
FrostMoon
发表于 2019-2-16 17:42:37
支持
蔡周杰
发表于 2019-2-16 21:58:26
而黯然
复方谷氨酰胺
发表于 2019-2-17 08:54:28
mark
清风逐梦丶
发表于 2019-2-19 14:46:35
加油
skygy92
发表于 2019-2-19 15:39:24
000
十七言
发表于 2019-2-19 19:17:01
看看
krystal-fan
发表于 2019-2-20 13:59:16
{:10_261:}
chenzhou
发表于 2019-2-20 17:42:54
{:5_90:}
HVERAGIOW
发表于 2019-2-20 18:15:03
0.10个
1.11个
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;
}
bill = cost * flag;
B.
if (ibex > 14)
{
sheds = 3;
}
elae
{
sheds = 2;
}
help = 2 * sheds;
C.
while(1)
{
scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
break;
}
count++;
}
0.
#include<stdio.h>
#define PRINCIPAL 10000
#define INTEREST_S 0.1
#define INTEREST_C 0.05
int main()
{
int year;
double pri_fish = PRINCIPAL,pri_night = PRINCIPAL;
for(year = 0; pri_fish >= pri_night; year++)
{
pri_fish = PRINCIPAL * (1 + (year + 1) * INTEREST_S);
pri_night += pri_night * INTEREST_C;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n",year);
printf("小甲鱼的投资额是:%.2f\n",pri_fish);
printf("黑夜的投资额是:%.2f\n",pri_night);
return 0;
}
1.
#include<stdio.h>
#define PRINCIPAL 4000000
#define COST 500000
#define INTEREST 0.08
int main()
{
int year;
double price = PRINCIPAL;
for(year = 0; price > 0; year++)
{
price -= COST;
price += price * INTEREST;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗...\n",year);
return 0;
}
2.
#include<stdio.h>
#include<math.h>
int main()
{
int i = 1;
double pi = 0,n = 1,f = pow(10,-8);
while(fabs(n) >= f)
{
pi += n;
n = pow(-1,i) * 1.0 / (2 * i + 1);
i++;
}
printf("PI 的小数点后7位近似值位:%.7f\n",4 * pi);
return 0;
}
3.
#include<stdio.h>
#define year 2
int main()
{
int month,twain1 = 1,twain2 = 1,temp;
for(month = 3; month <= 12 * year; month++)
{
temp = twain2;
twain2 += twain1;
twain1 = temp;
}
printf("两年后有%d对兔子。\n",twain2);
return 0;
}