下载此文档

《C语言编程练习》PPT课件.ppt


文档分类:IT计算机 | 页数:约105页 举报非法文档有奖
1/105
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/105 下载此文档
文档列表 文档介绍
*ProgrammingExercisesNorthChinaElectricPowerUniversity*Chapter4ManagingInputandOutputOperations : (a) (b) (c)*Chapter4ManagingInputandOutputOperations () { floatx,y; printf("Pleaseinputthevalueofxandy:\n"); printf("x="); scanf("%f",&x); printf("y="); scanf("%f",&y); printf("(a)(x+y)/(x-y)=%f\n",(x+y)/(x-y)); printf("(b)(x+y)/2=%f\n",(x+y)/2); printf("(c)(x+y)(x-y)=%f\n",(x+y)*(x-y));}*Chapter4ManagingInputandOutputOperations ,roundthemofftothenearestintegersandprintouttheresultsinintegerform: - -*Chapter4ManagingInputandOutputOperations () { floatx; printf("Pleaseinputthenumber:"); scanf("%f",&x); printf("Thenumberis:%.0f\n",x);}*Chapter4ManagingInputandOutputOperations -digitintegersandprinttheproductofintegersasshownbelow. 45 × 37 7×45is 315 3×45is 135 Addthem 1665*Chapter4ManagingInputandOutputOperations () { intx,y,m,n; printf("Pleaseinput2two-digitintegers:"); scanf("%d%d",&x,&y); printf("\n\t\t%6d\n\t\t*%5d\n",x,y); printf("\t\t______\n"); printf("%d*%dis\t\t%6d\n",y%10,x,y%10*x); printf("%d*%dis\t\t%5d\n",y/10,x,y/10*x); printf("\t\t______\n"); printf("Addthem\t%6d\n",y*x); printf("\t\t______\n");}*Chapter5 DecisionMakingandBranching 'odd'of'even'andprintthemessage NUMBERISEVEN or NUMBERISODD (a)withoutusingelseoption,and (b)withelseoption.*Chapter5 DecisionMakingandBranching () /*(a)*/{ intn; printf("Pleaseinputaninteger:"); scanf("%d",&n); if(n%2) printf("%dISODD\n",n); if(n%2==0) printf("%dISEVEN\n",n); }*Chapter5 DecisionMakingandBranching () /*(b)*/{ intn; printf("Pleaseinputaninteger:"); scanf("%d",&n); if(n%2) printf("%dISODD\n",n); else printf("%dISEVEN\n",n); }

《C语言编程练习》PPT课件 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数105
  • 收藏数0 收藏
  • 顶次数0
  • 上传人54156456
  • 文件大小452 KB
  • 时间2019-04-10