C语言程序设计课后答案_罗朝盛第1章****题参考答案
1. (略)
判断题
1
2
3
4
5
√
×
√
×
√
填空题
main
函数的首部、函数体
{、}
main、main
语句、分号(;)
选择题
1
2
3
4
5
C
C
C
A
B
选择题
#include <>
main()
{
int a, b, s;
float t;
printf("Enter A,B=?\n");
scanf("%d%d", &a, &b);
s=a+b;
t=a*b;
printf("s=%d, t=%f\n", s, t);
}
#include <>
main()
{
printf("=================\n");
printf(" Hello! \n");
printf(" How do you do \n");
printf("=================\n");
}
(3)
#include <>
main()
{
int r, h;
float v;
printf("Enter R, H=?\n");
scanf("%d%d", &r, &h);
v=3.*r*r*h;
printf("v=%f\n",v);
}
第2章****题参考答案
一.(略)
16
10
16、16、11
4、10、6
18、3、3
sin(65*)+2*(3. +exp(y))/(x-y)
25、25
27
4
0
选择题
1
2
3
4
5
6
7
8
9
10
11
12
D
D
C
B
D
A
D
B
C
D
A
B
四、编程题
1.
#include <>
main()
{
int x, a, b, c;
printf("Enter a intger number x=?\n");
scanf("%d",&x);
a=x /100;
b=x%100/10;
c=x%10;
printf("%d %d %d\n", a, b, c);
}
2.
#include <>
main()
{
unsigned a, b,r1,r2,r3;
scanf("%u%u", &a, &b);
r1=a &b;
r2=a|b;
r3=a^b;
printf("r1=%u,r2=%u,r3=%u\n",r1,r2,r3);
getch();
}
3.
#include <>
main()
{
float a, b, h, s;
scanf("%f%f?%f", &a, &b, &h);
s=(a+b)*h/2;
printf("s=%f\n", s);
}
第3章****题参考答案
一、判断题
1
2
3
4
5
6
×
×
×
√
√
×
填空题
语句
表达式语句
{ }
函数
由“%”和格式字符
&
getchar()
27 ,33 ,1b
x(1)= x(2)=-
5+ 6
程序阅读题
1、
p=
p=
p=
p=
p=
p=
2、
a----ASCII: 97
a----ASCII: 97
a----ASCII: 97
编程题
1、
#include <>
main()
{
int a, b;
float r1, r2;
scanf("%d%d", &a, &b);
r2=a+b;
r1=a*b/r2;
printf("r1=%,r2=%\n", r1, r2);
}
2、
#include <>
main()
{
float c, f;
printf("Input C=");
scanf("%f", &c);
f=*c+32;
printf("F=%f\n", f);
}
3、
#include <>
void main()
{
float c1, c2, c3, ver, s;
printf("Input a, b and c:");
scanf("%f%f%f", &c1, &c2, &c3);
s=c1+c2+c
C语言程序设计课后答案 罗朝盛 来自淘豆网www.taodocs.com转载请标明出处.