Maxwell1130
发表于 2020-9-15 22:18:22
0,10个A。
1,无数个B。
2,a, b, c
3, a = 13, b = 3, c = 8
4, x ?z = fabs(x):z= 0
5,
A,
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
B,
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C,
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
scanf("%d", &score);
乌云之上
发表于 2020-9-16 14:16:24
最后两题好难
HaloDora
发表于 2020-9-16 14:26:10
1
那一年的C入门
发表于 2020-9-17 10:01:10
对答案
街角提子
发表于 2020-9-17 19:10:33
answer
aptx48698251
发表于 2020-9-18 09:45:00
1
abbcabc
发表于 2020-9-18 17:01:50
2
Nephpito
发表于 2020-9-19 12:12:49
j
qiukailin
发表于 2020-9-19 12:21:30
xx
ZachV
发表于 2020-9-19 12:43:37
d
养老小青年
发表于 2020-9-19 12:53:02
答案
热呃呃呃呃
发表于 2020-9-19 21:48:14
看看答案
Healer_1
发表于 2020-9-20 14:30:58
1
spenser
发表于 2020-9-20 19:00:36
/**
求绝对值
#include <stdio.h>
int main()
{
int x,z;
printf("请输入x的值:\n");
scanf("%d",&x);
z = (x >=0 ? x : -x);
printf("x的绝对值为:%d\n",z);
return 0;
}
*/
/**
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
readin: scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
}
else
{
count++;
readin;
}
*/
/** 算利息题
#include <stdio.h>
int main()
{
float xjy=10000;
float heiye = 10000;
int years;
float xjylx, heiyelx;
for(int i = 0;i<100;i++)
{
xjylx = 10000 + 0.1 * i * 10000;
heiyelx = 10000 * pow(1.05,i);
if(xjylx < heiyelx)
{
years = i;
break;
}
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n",years);
printf("小甲鱼投资额为:%f\n",xjylx);
printf("黑夜投资额为:%f\n",heiyelx);
return 0;
}
*/
/** 小甲鱼什么时候破产
#include <stdio.h>
int main()
{
float total = 4000000;
float everyyearcost = 500000;
for(int i =1;i<100;i++)
{
total = total * 1.08 -500000;
printf("%d年之后,小甲鱼还剩下%f资金!\n",i,total);
if(total<=0)
{
printf("%d年之后,小甲鱼破产了!\n",i);
break;
}
}
return 0;
}
*/
zhima_
发表于 2020-9-21 08:17:29
朕想知道
xiaoxudove
发表于 2020-9-21 10:48:04
1
gzq44
发表于 2020-9-21 13:56:57
{:10_323:}
fatcat1618
发表于 2020-9-22 12:18:14
{:10_277:}
麦za
发表于 2020-9-22 13:51:22
100
10
a,b,c
14 3 9
Lowell
发表于 2020-9-22 15:46:12
测试题:
0、10
1、不打印B;
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;
}
sheds = 2;
help = 2 * sheds;
C:
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
scanf("%d", &score);
动动手:
0、
{:5_102:}#include <stdio.h>
#include <math.h>
int main()
{
int money_ini= 10000;
int money1, money2;
money1= 0;
money2 = money_ini;
float rate1 = 0.1, rate2 = 0.05;
int year;
for (year =1; year < 100; year++) {
money1 = money_ini *rate1*year+ money_ini;
money2 = money2 * (1+rate2);
if (money2 > money1) {
printf("经过%d年后,超过!", year);
printf("小甲鱼的投资额为:%d", money1);
printf("黑夜的投资额为:%d", money2);
break;
}
}
return 0;
}
1、
#include <stdio.h>
int main() {
float rate = 0.08;
float total_money = 400;
float cost = 50;
int year = 0;
for (year; year < 100; year++) {
total_money = (total_money - cost)*(1 + rate);
if (total_money < cost) {
printf("%d年之后,小甲鱼一贫如洗!",year+1);
break;
}
}
return 0;
}
2、
#include <stdio.h>
#include <math.h>
int main() {
double result=0,temp;
int i = 1;
for (; i < 10000000000; i++) {
if (i % 2 == 0)//求余,偶数
{
temp = -1 / double((2 * i - 1));
}
else {
temp = 1 / double((2 * i - 1));
}
if (fabs(temp) < 1e-8) {
break;
}
result = result + temp;
}
printf("pi=%.7f\n",4*result);
//printf("i=%d\n",i);
//printf("%.10f\n",1e-8);
return 0;
}