长沙理工大学
2010C
语言实验报告参考答?/p>
实验一
熟悉
C
语言程序开发环境及数据描述
四、程序清?/p>
1
.编写程序实现在屏幕上显示以下结果:
The dress is long
The shoes are big
The trousers are black
答案?/p>
#include<stdio.h>
main()
{
printf("The dress is long\n");
printf("The shoes are big\n");
printf("The trousers are black\n");
}
2
.改错题
(将正确程序写在指定位置?/p>
正确的程序为?/p>
#include <stdio.h>
main()
{
printf("
商品名称
价格
\n");
printf("TCL
电视?/p>
?/p>
7600\n");
printf("
美的空调
?/p>
2000\n");
printf("SunRose
键盘
?/p>
50.5\n");
}
2
.编写程序:
a=150,b=20,c=45,
编写?/p>
a/b
?/p>
a/c(
?/p>
)
?/p>
a%b
?/p>
a%c(
余数
)
的程序?/p>
答案?/p>
#include<stdio.h>
main()
{
int a,b,c,x,y;
a=150;
b=20;
c=45;
x=a/b;
y=a/c;
printf("a/b
的商
=%d\n",x);
printf("a/c
的商
=%d\n",y);
x=a%b;
y=a%c;
printf("a/b
的余?/p>
=%d\n",x);
printf("a/c
的余?/p>
=%d\n",y);