- 1、本文档共13页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
南大成考C语言课后习题
3.16
#include stdio.h
main()
{double a,b,c,s,v;
printf(input a,b,c:);
scanf(%lf%lf%lf,a,b,c);
s=a*b;
v=a*b*c;
printf(a=%lf,b=%lf,c=%lf\n,a,b,c);
printf(s=%lf,v=%lf,s,v);
}
3.17
#include stdio.h
main()
{int x,y,z;
x=560;
y=x/60;
z=x%60;
printf(%d:%d,y,z);
}
3.18
#include stdio.h
main()
{int x,y;
scanf(%d%d,x,y);
printf(%d\n%d\n,x/y,x%y);
}
3.19
#include stdio.h
main()
{double x,y,z,sum,ave;
printf(Enter x,y,z:);
scanf(%lf%lf%lf,x,y,z);
sum=x+y+z;
ave=sum/3;
ave=ave*10;
ave=ave+0.5;
ave=(int)ave;
ave=ave/10;
printf(%f,ave);
}
3.20
#include stdio.h
main()
{int a,b,c,d;
printf(enter a,b,c:\n);
scanf(%d%d%d,a,b,c);
d=a;a=c;c=b;b=d;
printf(%d %d %d,a,b,c);
}
4.23
#include stdio.h
main()
{int x;
scanf(%d,x);
if(x%2==0)
{printf(it is even number);
getch();}
else
{printf(it is odd number);
getch();}
}
4.24
#include stdio.h
main()
{int a,b,c;
scanf(%d%d%d,a,b,c);
if(abac)
{printf(%d,a);
getch();}
else
{if(bc)
{printf(%d,b);
getch();
}
else
{printf(%d,c);
getch();
}
}
}
5.17
#include stdio.h
#include math.h
main()
{int a,i,sum;
sum=0;
i=1;
for(a=1;fabs(a)101;a=fabs(a)+2)
{i++;
if(i%2==0)
{a*=-1;
sum+=a;
}
else
sum+=a;
}
printf(%d,sum);
getch();
}
5.19
#include stdio.h
main()
{int year,i;
i=0;
for(year=2000;year=3000;year++)
{if(year%400==0||year%4==0year%100)
{printf(%d ,year);
getch();
++i;
{if(i%10==0)
{printf(\n);
getch();
}
else ;
}
}
else ;
}
}
5.20
#include stdio.h
#include math.h
main()
{int k,i,j;
for(k=0;k7;k++)
{for(i=0;ifabs(3-k);i++)
{printf( );
getch();
}
for(j=0;j=6-2*i;j++)
{printf(*);
getch();
}
printf(\n);
getch();
}
}
6.19
#include stdio.h
#include ctype.h
main()
{int n=0;
char ch;
while((ch=getchar())!=\n)
{if(n%3==0)
{putchar(\n);
getch();
}
n++; printf(ch=%c,ASCII=%d ,ch,ch);
getch();
}
}
6.20
#include stdio.h
#include ctype.h
main()
{char ch;
int n=0;
while((ch=getchar())!=\n)
{if(ch=0ch=9)
n=n*10+ch-0;
}
文档评论(0)