[计算机类试卷]国家二级C语言机试(操作题)模拟试卷206及答案与解析.doc

上传人:eveningprove235 文档编号:498131 上传时间:2018-11-28 格式:DOC 页数:5 大小:30KB
下载 相关 举报
[计算机类试卷]国家二级C语言机试(操作题)模拟试卷206及答案与解析.doc_第1页
第1页 / 共5页
[计算机类试卷]国家二级C语言机试(操作题)模拟试卷206及答案与解析.doc_第2页
第2页 / 共5页
[计算机类试卷]国家二级C语言机试(操作题)模拟试卷206及答案与解析.doc_第3页
第3页 / 共5页
[计算机类试卷]国家二级C语言机试(操作题)模拟试卷206及答案与解析.doc_第4页
第4页 / 共5页
[计算机类试卷]国家二级C语言机试(操作题)模拟试卷206及答案与解析.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家二级 C语言机试(操作题)模拟试卷 206及答案与解析 一、程序填空题 1 给定程序中,函数 fun的功能是:找出 100 999之间 (含 100和 999)所有整数中各位上数字之和为 x(x为一正整数 )的整数,然后输出;符合条件的整数个数作为函数值返回。 例如,当 x值为 5时, 100 999之间各位上数字之和为 5的整数有: 104、113、 122、 131、 140、 203、 212、 221、 230、 302、 311、 320、 401、 410、 500。共有 15个。当 x值为 27时,各位数字之和为 27的整数是: 999。 只有 1个。 请在程序的下划线处填入

2、正确的内容并把下划线删除,使程序得出正确的结果。 注意:源程序存放在考生文件夹下的 BLANKl C中。 不得增行或删行,也不得更改程序的结构 ! #include int fun(int x) int n, s1, s2, s3, t; n=0; t=100: *found* while(t0): “); scanf(“ d“, x); printf(“ nThe resu2t is: d n“, fun(x); 二、程序修改题 2 给定程序 MODIl C中 fun函数的功能是:分别统计字符串中大写字母和小写字母的个数。 例如,给字符串 S输入: AAaaBBb123CCccccd则应输出

3、结果: upper=6,lower=8。 请改正程序中的错误,使它能计算出正确的结果。 注意:不要改动 main函数,不得增行或删行,也不得更改程序的结构 ! #inc2ude *found* void fun (char *s, int a, int b) while(*s) if (*s = A *s = a *s #include double fun(int n) NONO() *请在此函数内打开文件,输入测试数据, 调用 fun函数,输出数据,关闭文件。 * FILE *rf, *wf; int n, i; double s; rf=fopen(“in dat“, “r“); wf=fopen(“out dat“, “w“); for(i=0; i1),所以判别 i是否为素数,只要用 2、 3、 、 j-1这些数逐个去除 i,观察余数是否为 0即可,只要有一次相除余数为 0, i就不是素数,否则 i为素数。 (2)在循环中找到每一个素数,然后对其求平方根,然后进行累加求和。

展开阅读全文
相关资源
猜你喜欢
  • AECMA PREN 2954-001-2009 Aerospace series Macrostructure of titanium and titanium alloy wrought products Part 001 General requirements Edition P 1《航空航天系列.钛及钛合金加工产品的宏观结构.第001部分 一般要求.pdf AECMA PREN 2954-001-2009 Aerospace series Macrostructure of titanium and titanium alloy wrought products Part 001 General requirements Edition P 1《航空航天系列.钛及钛合金加工产品的宏观结构.第001部分 一般要求.pdf
  • AECMA PREN 2954-002-2009 Aerospace series Macrostructure of titanium and titanium alloy wrought products Part 002 Macrostructure of bar section forging stock and forgings Edition P.pdf AECMA PREN 2954-002-2009 Aerospace series Macrostructure of titanium and titanium alloy wrought products Part 002 Macrostructure of bar section forging stock and forgings Edition P.pdf
  • AECMA PREN 2957-1991 Aerospace Series Method of Preparation of Forged Samples Edition P 1《航空航天系列锻件样本准备方法.P1版》.pdf AECMA PREN 2957-1991 Aerospace Series Method of Preparation of Forged Samples Edition P 1《航空航天系列锻件样本准备方法.P1版》.pdf
  • AECMA PREN 2959-1999 Aerospace Series Heat Resisting Alloy NI-PH1302 (NiCr20Co13Mo4Ti3Al) Solution Treated and Cold Worked Bar for Forged Fasteners 3 mm Less Than or Equal to D Les.pdf AECMA PREN 2959-1999 Aerospace Series Heat Resisting Alloy NI-PH1302 (NiCr20Co13Mo4Ti3Al) Solution Treated and Cold Worked Bar for Forged Fasteners 3 mm Less Than or Equal to D Les.pdf
  • AECMA PREN 2960-1988 Aerospace Series Heat Resisting Nickel Base Alloy (NI-P101HT) Cold Worked and Solution Treated Bar for Machining for Fasteners 3 Less Than or Equal to D Less T.pdf AECMA PREN 2960-1988 Aerospace Series Heat Resisting Nickel Base Alloy (NI-P101HT) Cold Worked and Solution Treated Bar for Machining for Fasteners 3 Less Than or Equal to D Less T.pdf
  • AECMA PREN 2961-1994 Aerospace Series Heat Resisting Alloy NI-PH2601 Solution Treated Bar for Machined Fasteners D is Less Than or Equal to 50 mm Rm is Greater Than or Equal to 127.pdf AECMA PREN 2961-1994 Aerospace Series Heat Resisting Alloy NI-PH2601 Solution Treated Bar for Machined Fasteners D is Less Than or Equal to 50 mm Rm is Greater Than or Equal to 127.pdf
  • AECMA PREN 2962-1996 Aerospace Series Carbon Fibre Filament Yarn (Polyacrylonitrile Precursor) Technical Specification Edition P 1《航空航天系列碳丝纱线聚丙烯腈先驱技术规范.P1版》.pdf AECMA PREN 2962-1996 Aerospace Series Carbon Fibre Filament Yarn (Polyacrylonitrile Precursor) Technical Specification Edition P 1《航空航天系列碳丝纱线聚丙烯腈先驱技术规范.P1版》.pdf
  • AECMA PREN 2985-1994 Aerospace Series Nickel-Cadmium Batteries of Format A Type Edition p 1《航空航天系列镍镉电池形式A类.P1版》.pdf AECMA PREN 2985-1994 Aerospace Series Nickel-Cadmium Batteries of Format A Type Edition p 1《航空航天系列镍镉电池形式A类.P1版》.pdf
  • AECMA PREN 2986-1994 Aerospace Series Nickel-Cadmium Batteries of Format B Type Edition P 1《航空航天系列镍镉电池形式B类.P1版》.pdf AECMA PREN 2986-1994 Aerospace Series Nickel-Cadmium Batteries of Format B Type Edition P 1《航空航天系列镍镉电池形式B类.P1版》.pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1