- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
基本阅读程序题及答案
基本输入输出
7.
#include stdio.h
main()
{ int a=1,b=2;
a=a+b;
b=a-b;
a=a-b;
printf(“a=%d,b=%d\n”,a,b);
}
运行结果为:
a=2,b=1
13.
#include stdio.h
main( )
{ int a=3, b=4;
int z=a+b;
printf(“z=%d\n”,z);
}
.
#include stdio.h
main()
{ int x, b0, b1, b2;
printf(Please enter an integer x:);
scanf(%d, x);
b2 = x / 100;
b1 = (x - b2 * 100) / 10;
b0 = x % 10;
printf(bit0=%d, bit1=%d, bit2=%d\n, b0, b1, b2);
}
若输入352,运行结果为:
bit0=2, bit1=5, bit2=3
程序控制结构(顺序,分支,循环)
1.
#include stdio.h
main()
{ int a=1,b=3,c=5;
if (c==a+b)
printf(yes\n);
else
printf(no\n);
}
运行结果为:
no
2.
#include stdio.h
main()
{ int a=12, b= -34, c=56, min=0;
min=a;
if(minb)
min=b;
if(minc)
min=c;
printf(min=%d, min);
}
运行结果为:
min=-34
3.
#include stdio.h
main()
{ int x=2,y= -1,z=5;
if(xy)
if(y0)
z=0;
else
z=z+1;
printf(“%d\n”,z);
}
运行结果为:
5
4.
#include stdio.h
main()
{int a=10,b=50,c=30;
if(ab)
a=b;
b=c;
c=a;
printf(a=%d b=%d c=%d\n,a,b,c);
}
运行结果为:
a=10 b=30 c=10
5.
#include stdio.h
main()
{ float a,b,c,t;
a=3;
b=7;
c=1;
if(ab)
{t=a;a=b;b=t;}
if(ac)
{t=a;a=c;c=t;}
if(bc)
{t=b;b=c;c=t;}
printf(%5.2f,%5.2f,%5.2f,a,b,c);
}
运行结果为:
00, 2.00, 7.00
6.
#include stdio.h
main()
{int a=2;
float num=3.12,x;
if(num4)
x=2*num*a;
printf(result is%f\n,x);
}
运行结果为:
result is12.4800
7.
#includestdio.h
main( )
{ char c=’A’;
if ((‘0’=c ) (c=’9’))
printf(“YES”);
else
printf(“NO”);
}
运行结果为:
NO
8.
#include stdio .h
main ( )
{ float c=3.0 , d=4.0;
if ( cd )
c=5.0;
else
if ( c==d )
c=6.0;
else
c=7.0;
printf ( “%.1f\n”,c ) ;
}
运行结果为:
7.0
9.
#include stdio.h
main()
{ int a=0,b=1,c=0,d=20;
if(a)
d=d-10;
else
if(!b)
if(!c)
d=15;
else d=25;
printf(d=%d\n,d);
}
运行结果为:
d=20
10.
#include stdio.h
main()
{ int a=2,b=3,c=1;
if (ab)
if (ac)
printf (“%d \n”,a);
else
printf (“%d \n”,c);
printf (“over! \n”);
}
运行结果为:
over!
11.
#include stdio.h
main()
{ int m;
scanf(%d, m);
if (m = 0)
{ i
文档评论(0)