计算机C语言课后习题集答案.doc

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C语言课后习题答案-第四版- 第一章 5、请参照本章例题,编写一个C语言程序,输出以下信息: **************************** V e r y G o o d ! **************************** #include stdio.h int main ( ) { printf (**************************\n\n); printf( Very Good!\n\n); printf (**************************\n); return 0; } 6、编写一个C语言程序,输入a,b,c三个值,输出其中最大值。 #include stdio.h int main() { int a,b,c,max; printf(please input a,b,c:\n); scanf(%d%d%d,a,b,c); max=a; if (maxb) max=b; if (maxc) max=c; printf(The largest number is %d\n,max); return 0; } #include stdio.h int main() { int a,b,c,max; printf(please input a,b,c:\n); scanf(%d%d%d,a,b,c); max=ab?a:b; max=maxc?max:c; printf(The largest number is %d\n,max); return 0; } 第3章 1、假如我国国民生产总值的年增长率为9%,计算10年后我国国民生产总值与现在相比增长多少百分比。计算公式为 P=(1+r)^n r 为年增长率,n 为年数,p为与现在相比的倍数。 #include stdio.h #include math.h int main() { float p,r,n; r=0.1; n=10; p=pow(1+r,n); printf(p=%f\n,p); return 0; } 2、存款利息计算。有1000元,想存5年,可按以下5种办法存: (1)一次存5年期。 (2)先存2年期,到期后将本息在存3年期。 (3)先存3年期,到期后将本息在存2年期。 (4)先存1年期,到期后将本息在存1年期,连续存5次。 (5)存活期存款。活期利息每一季度结算一次。 2007年12月的银行存款利息如下: 1年定期存款利息为4.14%; 2年定期存款利息为4.68%; 3年定期存款利息为5.4%; 5年定期存款利息为5.85%; 活期存款利息为0.27%(活期利息每一季度结算一次。) 如果r 为年利率,n 为存款年数,则计算本息和的公式为 1年期本息和:P=1000*(1+r); n年期本息和:P=1000*(1+n*r); 存n次1年期的本息和:P=1000*(1+ r)^n; 存活期本息和:P=1000*(1+r/4)^4n。 说明:P=1000*(1+r/4)^4n。是一个季度的本息和。 #include stdio.h #include math.h int main() { float r5,r3,r2,r1,r0,p,p1,p2,p3,p4,p5; r5=0.0585; r3=0.054; r2=0.0468; r1=0.0414; r0=0.0072; p=1000; p1=p*((1+r5)*5); // 一次存5年期 p2=p*(1+2*r2)*(1+3*r3); // 先存2年期,到期后将本息再存3年期 p3=p*(1+3*r3)*(1+2*r2); // 先存3年期,到期后将本息再存2年期 p4=p*pow(1+r1,5); // 存1年期,到期后将本息存再存1年期,连续存5次 p5=p*pow(1+r0/4,4*5); // 存活期存款。活期利息每一季度结算一次 printf(p1=%f\n,p1); // 输出按第1方案得到的本息和 printf(p2=%f\n,p2); // 输出按第2方案得到的本息和 printf(p3=%f\n,p3); // 输出按第3方案得到的本息和 printf(p4=%f\n,p4); // 输出按第4方案得到的本息和 printf(p5=%f\n,p5); // 输出按第5方案得到的本息和 return

文档评论(0)

wx171113 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档