- 7
- 0
- 约2.42万字
- 约 28页
- 2019-10-19 发布于安徽
- 举报
. . . .
参考
六、编程题参考答案
1.编程,统计在所输入的50个实数中有多少个正数、多少个负数、多少个零。
#include stdio.h
#define N 50
void main()
{ float x; unsigned int s1,s2,s3,i;
s1=s2=s3=0;
for(i=1;i=N;i++) {
scanf(%f,x);
if(x0) s1++; else if(x==0) s2++; else s3++;
}
printf(负数%u个,零%u个,正数%u个\n,s1,s2,s3);
}
?
2. 编程,计算并输出方程 X2+Y2=1989 的所有整数解。
#include stdio.h
void main()
{ int x,y;
for(x=-45;x=45;x++) {
y=-45;
while(y=45) {
if(x*x+y*y==1989)
原创力文档

文档评论(0)