- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
c语言(廖)课后答案
1================
P35-6
#include stdio.h
main()
{
double r,s,v;
printf(Please Enter radius: );
scanf(%lf,r);
v=4.0/3*3.14*r*r*r;
s=4*3.14*r*r;
printf(V=%lf\n,v);
printf(S=%lf\n,s);
getch();
}
2===============
P59-4.C
#includestdio.h
main()
{
int y;
printf (Please enter a year:);
scanf ( %d,y);
if ( y%4==0 y%100!=0 || y%400==0 )
printf(It is a leap year.\n);
else
printf(It is not a leap year.\n);
getch();
}
P59-5.C
#includestdio.h
main()
{
int year, month, day;
printf(Please enter a year and a month:);
scanf(%d%d, year, month);
switch(month)
{
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
day = 31;
break;
case 4: case 6: case 9: case 11:
day = 30;
break;
case 2:
if(year%400==0 || (year%4==0 year%100!=0))
day = 29;
else
day = 28;
}
printf(It has %d days.\n, day);
getch();
}
P59-6.C
#include stdio.h
main( )
{
int x, i, sum=0, n=0;
printf(\nEnter 10 integer number :\n);
for(i=1; i=10; i++) {
scanf(%d, x);
if ( x%2==0 ) {
sum = sum + x;
n++;
}
}
printf(%.2f\n, 1.0*sum/n);
getch();
}
P59-7.C
#include stdio.h
main()
{
int c,inWord;
inWord = 0;
while((c = getchar()) != \n){
if(c = a c =z || c = A c = Z){
if(!inWord) {
inWord = 1;
if(c = a c =z) c= c-a+A;
}
}
else {
inWord = 0;
}
putchar(c);
}
getch();
}
P59-8.C
#include stdio.h
main()
{
int i,m,n;
printf(Please Enter two integers: );
scanf(%d%d,m,n);
for(i=1;in;i++)
if ((i*m)%n ==0) break;
printf(lcd=%d\n,i*m);
getch();
}
P59-10.C
#include stdio.h
main()
{
int len1,len2,inWord;
char c;
inWord=0;
len1=len2=0;
do{
c=getchar();
if(c=a c=z || c=A c=Z){
if(!inWord){
inWord=1;
len1=len2;
len2=0;
}
len2++;
}else{
if(inWord){
inWord=0;
}
}
}while(c!=\n);
printf(%d\n,len1);
getch();
}
P61-1.C
#include stdio.h
m
文档评论(0)