- 7
- 0
- 约8.12千字
- 约 24页
- 2017-05-07 发布于河南
- 举报
c语言程序设计有关的题
* * 1. #include stdio.h void main( ) { char ch1 = A; float pi = 3.14f; printf(i = %d \n , 10 - 2 * 5 ); printf(ch1 = %c \n , ++ch1); printf(pi = %5.2f \n , pi); } 一、阅读程序,写运行结果(10 小题,每题4 分,共40 分) 2. #include stdio.h void main() { int x , y , t ; x = 8 ; y = 5 ; if ( x y ) { t = x ; x = y ; y = t ; } printf( %d , %d \n , x , y ); } 3. #includestdio.h void main() { float score = 100; if (score60) printf(E\n); else switch ( ( int ) score / 10 ) { case 10: case 9: printf(A\n); case 8: printf(B\n); case 7: printf(C\n); break; case 6: printf(D\n); break; default: printf(error\n); } } 4. #include stdio.h void main() { int number , digit; number = 1234; while ( number != 0 ) { digit = number % 10 ; printf( %d , digit ) ; number = number / 10 ; } } 5. #include stdio.h void main( ) { int i, s[5]; float a=0.0; for(i=0;i5;i++) s[i] = 10 - i; for(i=0;i5;i++) a = a + s[i]; a=a/5; printf(average=%f\n,a); printf(scores(average):\n); for(i=0;i5;i++) if (s[i]a) printf(%4d, s[i]); } 6. #include stdio.h void main ( ) { int a[2][3]={{2, 5, 4},{3, 6, 8}}; int b[3][2], i, j; for (i=0; i=1; i++) { for (j=0; j=2; j++) b[j][i]=a[i][j]; } printf(array b:\n); for (i=0; i=2; i++) { for (j=0; j=1; j++) printf(%5d, b[i][j]); printf(\n); } } 7. #include stdio.h void main() { char c, string[81]; int i, n=0, flag=0; gets(string); for(i=0; c=string[i]; i++) if (c==’ ’) flag = 0; else if (flag == 0) { flag = 1; n++; } printf(“n= %d”, n); } 输入:We are the world!(回车) 8. #include stdio.h long fac( int x ) { int i ,f = 1 ; for( i = 1 ; i = x ; i ++) f = f * i; return (f); } void main() { int m , n , c ; m = 5 ; n = 3 ; if ( m n ) { c=fac(m)/(fac(n)*fac(m-n
您可能关注的文档
- 2013届高三生物 实验专项突破30 调查当地环境污染课件 新人教版.ppt
- 2013届高三生物 实验专项突破31 DNA的粗提取与鉴定 新人教版 课件.ppt
- 2013届高三生物考前实验专项突破名师精品5--观察植物细胞的质壁分享及复原.ppt
- 2013届高考物理考纲专项复习课件:实验-传感器的简单使用(12张PPT).ppt
- 2013届高考物理考纲专项复习课件:实验(一)探究弹力与弹簧伸长的关系(11张PPT).ppt
- 2013届高考物理考纲专项复习课件:实验-验证牛顿运动定律(11张PPT).ppt
- 2013年中考考纲解读与复习策略(作文部分).ppt
- 2013年5月物流证书课程考试复习资料仓储管理(二).ppt
- 2013年最新高中语文精品教学课件:2.1指南录课件1(苏教版必修3).ppt
- 2013年最新高中语文精品教学课件:2.1指南录课件2(苏教版必修3).ppt
最近下载
- 附件: 黑龙江省年“村村大学生计划(培养)” 招 生 简 章 “村村 .doc VIP
- 往年江苏省教师招聘考试教育学心理学真题及答案.docx VIP
- 国资集团考试试题及答案.docx VIP
- 部编版语文一年级下册阅读11《浪花》课件PPT.pptx VIP
- 2018海湾GST-QKP04、GST-QKP04 2气体灭火控制器说明书.docx
- 浙江省杭州市西湖区之江中学2024-2025学年高二上学期期末数学试题(解析版).docx VIP
- 人教版五年级上册数学期末测试卷及参考答案ab卷.docx VIP
- [中央]2025年中国建设银行建信养老金管理有限责任公司校园招聘20人笔试历年参考题库频考点试题附带答案详解.docx
- 海南省公务员考试模拟试题库《行测》部分及参考答案.docx VIP
- BS EN 14540-2014 国外国际规范.pdf VIP
原创力文档

文档评论(0)