1、哈尔滨工业大学C语言MOOC在线测试答案哈尔滨工业大学C语言2016年MOOC在线测试答案本答案仅供参考,请勿用于商业用途或进行未经同意的转载 第3周 1 计算两个数的平方和(3分) 题目内容: 从键盘读入两个实数,编程计算并输出它们的平方和,要求使用数学函数pow(x,y)计算平方值,输出结果保留2位小数。 提示:使用数学函数需要在程序中加入编译预处理命令 #include 以下为程序的运行结果示例: please input x and y: 1.2,3.4? result=13.00 输入格式: %f,%f 输出格式: 输入提示信息:Please input x and y:n 输出格式
2、:Result=%.2fn 为避免出现格式错误,请直接拷贝粘贴题目中给的格式字符串和提示信息到你的程序中。 时间限制:500ms内存限制:32000kb #include int main() float x,y,S,D; printf(Please input x and y:n); scanf(%f,%f,&x,&y); Uterine within film hyperplasia syndrome, ovarian cyst, and tumor (common type), pelvic inflammatory sex mass uterine within film cancer
3、 the 5 cases prostate hyperplasia, prostate inflammatory, prostate cancer, testicular tumor (common type) cryptorchidism, testicular development not full, Deputy testosterone inflammatory, testicular inflammatory, fine SAC cyst, fine cable varicose veins, semen cyst, sheath film product liquid, fine
4、 SAC cyst, fine cable reverse the 5 cases cardiovascular system congenital heart (common type), rheumatic valve disease, expansion type, and hypertrophy type myocardial disease. (Four) about nuclear medical Qu Wan ying Editor. nuclear medical Pei Zhuguo Editor. image nuclear medical Chen haozhu Edit
5、or, practical within science Chinese medical will Editor. clinical technology operation specification nuclear medical fascicles Chinese medical will Editor. clinical clinic guide nuclear medical fascicles Pan Zhongyun Editor, clinical nuclear medical Wang Shizhen Editor, molecular nuclear medical pa
6、rticipation revised implementation rules personnel Li Minghua, chenkemin, Geng Daoying, Liu Shiyuan, song Wang, Hu Bing, Xu Zhizhang, Zhao, Sun Xiaoguang amendment date: 2010-2-25 Medical test section physician training rules medical test section (and said test medical section) is to diagnosis, and
7、prevention, and treatment human disease or assessment health provides information for purpose, on from human of material for biology, and microbiology, and Immunology, and biochemistry, and blood Immunology, and blood learn, and biological physics, and cytology, test of clinical two level subject, i
8、ts laboratory work has to clinical provides test information Advisory (including test results explained and for further appropriate check provides recommends), and participation clinical S = pow(x,2); D = pow(y,2); printf(Result=%.2fn,S+D); return 0; 2 逆序数的拆分计算(3分) 题目内容: 从键盘输入一个4位数的整数,编程计算并输出它的逆序数(忽
9、略整数前的正负号)。例如,输入-1234,忽略负号,由1234分离出其千位1、百位2、十位3、个位4,然后计算4*1000+3*100+2*10+1 = 4321,并输出4321。再将得到的逆序数4321拆分为两个2位数的正整数43和21,计算并输出拆分后的两个数的平方和的结果。 以下是程序的运行结果示例: Input x: -1234? y=4321 a=43,b=21 result=2290 输入格式: %d 输出格式: 输入提示信息:Input x:n 逆序数输出格式:y=%dn 逆序数拆分后的输出格式:a=%d,b=%dn 平方和的输出格式:result=%dn 为避免出现格式错误,请
10、直接拷贝粘贴题目中给的格式字符串和提示信息到你的程序中。 时间限制:500ms内存限制:32000kb #include main() int x,b0,b1,b2,b3,y,a,b,c; printf(Input x:n); scanf(%d,&x); x = (int)fabs(x); /*取x绝对值*/ Uterine within film hyperplasia syndrome, ovarian cyst, and tumor (common type), pelvic inflammatory sex mass uterine within film cancer the 5 c
11、ases prostate hyperplasia, prostate inflammatory, prostate cancer, testicular tumor (common type) cryptorchidism, testicular development not full, Deputy testosterone inflammatory, testicular inflammatory, fine SAC cyst, fine cable varicose veins, semen cyst, sheath film product liquid, fine SAC cys
12、t, fine cable reverse the 5 cases cardiovascular system congenital heart (common type), rheumatic valve disease, expansion type, and hypertrophy type myocardial disease. (Four) about nuclear medical Qu Wan ying Editor. nuclear medical Pei Zhuguo Editor. image nuclear medical Chen haozhu Editor, prac
13、tical within science Chinese medical will Editor. clinical technology operation specification nuclear medical fascicles Chinese medical will Editor. clinical clinic guide nuclear medical fascicles Pan Zhongyun Editor, clinical nuclear medical Wang Shizhen Editor, molecular nuclear medical participat
14、ion revised implementation rules personnel Li Minghua, chenkemin, Geng Daoying, Liu Shiyuan, song Wang, Hu Bing, Xu Zhizhang, Zhao, Sun Xiaoguang amendment date: 2010-2-25 Medical test section physician training rules medical test section (and said test medical section) is to diagnosis, and preventi
15、on, and treatment human disease or assessment health provides information for purpose, on from human of material for biology, and microbiology, and Immunology, and biochemistry, and blood Immunology, and blood learn, and biological physics, and cytology, test of clinical two level subject, its labor
16、atory work has to clinical provides test information Advisory (including test results explained and for further appropriate check provides recommends), and participation clinical b3 = x/1000; /*取x千位*/ b2 = (x-b3*1000)/100; /*取x百位*/ b1 = (x-b3*1000-b2*100)/10; /*取x十位*/ b0 = x%10; /*取x个位*/ y = b3+b2*1
17、0+b1*100+b0*1000; printf(y=%dn,y); a = b0*10+b1; b = b2*10+b3; c = (a*a)+(b*b); printf(a=%d,b=%dn,a,b); printf(result=%dn,c); return 0; 3 拆分英文名(3分) 题目内容: 从键盘输入某同学的英文名(小写输入,假设学生的英文名只包含3个字母。如: tom),编写程序在屏幕上输出该同学的英文名,且首字母大写(如: Tom)。同时输出组成该英文名的所有英文字符在26个英文字母中的序号。 以下为程序的运行结果示例: Input your English name: t
18、om? Tom t:20 o:15 m:13 输入格式: %c%c%c 输出格式: 输入提示信息:Input your English name:n 首字母大写的英文姓名的输出格式:%c%c%cn 姓名中每个字母在26个英文字母中的序号的输出格式:%c:%dn 为避免出现格式错误,请直接拷贝粘贴题目中给的格式字符串和提示信息到你的程序中。 时间限制:500ms内存限制:32000kb Uterine within film hyperplasia syndrome, ovarian cyst, and tumor (common type), pelvic inflammatory sex m
19、ass uterine within film cancer the 5 cases prostate hyperplasia, prostate inflammatory, prostate cancer, testicular tumor (common type) cryptorchidism, testicular development not full, Deputy testosterone inflammatory, testicular inflammatory, fine SAC cyst, fine cable varicose veins, semen cyst, sh
20、eath film product liquid, fine SAC cyst, fine cable reverse the 5 cases cardiovascular system congenital heart (common type), rheumatic valve disease, expansion type, and hypertrophy type myocardial disease. (Four) about nuclear medical Qu Wan ying Editor. nuclear medical Pei Zhuguo Editor. image nu
21、clear medical Chen haozhu Editor, practical within science Chinese medical will Editor. clinical technology operation specification nuclear medical fascicles Chinese medical will Editor. clinical clinic guide nuclear medical fascicles Pan Zhongyun Editor, clinical nuclear medical Wang Shizhen Editor
22、, molecular nuclear medical participation revised implementation rules personnel Li Minghua, chenkemin, Geng Daoying, Liu Shiyuan, song Wang, Hu Bing, Xu Zhizhang, Zhao, Sun Xiaoguang amendment date: 2010-2-25 Medical test section physician training rules medical test section (and said test medical
23、section) is to diagnosis, and prevention, and treatment human disease or assessment health provides information for purpose, on from human of material for biology, and microbiology, and Immunology, and biochemistry, and blood Immunology, and blood learn, and biological physics, and cytology, test of
24、 clinical two level subject, its laboratory work has to clinical provides test information Advisory (including test results explained and for further appropriate check provides recommends), and participation clinical #include int main() char x,y,z,A; printf(Input your English name:n); scanf(%c%c%cn,
25、&x,&y,&z); A=x-32; /*首字母改为大写*/ printf(%c%c%cn,A,y,z); printf(%c:%dn,x,x-96); printf(%c:%dn,y,y-96); printf(%c:%dn,z,z-96); 4 计算体指数(3分) 题目内容: 从键盘输入某人的身高(以厘米为单位,如174cm)和体重(以公斤为单位,如70公斤),将身高(以米为单位,如1.74m)和体重(以斤为单位,如140斤)输出在屏幕上,并按照以下公式计算并输出体指数,要求结果保留到小数点后2位。 假设体重为w公斤,身高为h米,则体指数的计算公式为: 以下是程序的运行结果示例: Inpu
26、t weight, height: 70,174? weight=140 height=1.74 t=23.12 输入格式: %d,%d 输出格式: 输入提示信息:Input weight, height:n (注意:在height和逗号之间有一个空格) 体重输出格式:weight=%dn 身高输出格式:height=%.2fn Uterine within film hyperplasia syndrome, ovarian cyst, and tumor (common type), pelvic inflammatory sex mass uterine within film canc
27、er the 5 cases prostate hyperplasia, prostate inflammatory, prostate cancer, testicular tumor (common type) cryptorchidism, testicular development not full, Deputy testosterone inflammatory, testicular inflammatory, fine SAC cyst, fine cable varicose veins, semen cyst, sheath film product liquid, fi
28、ne SAC cyst, fine cable reverse the 5 cases cardiovascular system congenital heart (common type), rheumatic valve disease, expansion type, and hypertrophy type myocardial disease. (Four) about nuclear medical Qu Wan ying Editor. nuclear medical Pei Zhuguo Editor. image nuclear medical Chen haozhu Ed
29、itor, practical within science Chinese medical will Editor. clinical technology operation specification nuclear medical fascicles Chinese medical will Editor. clinical clinic guide nuclear medical fascicles Pan Zhongyun Editor, clinical nuclear medical Wang Shizhen Editor, molecular nuclear medical
30、participation revised implementation rules personnel Li Minghua, chenkemin, Geng Daoying, Liu Shiyuan, song Wang, Hu Bing, Xu Zhizhang, Zhao, Sun Xiaoguang amendment date: 2010-2-25 Medical test section physician training rules medical test section (and said test medical section) is to diagnosis, an
31、d prevention, and treatment human disease or assessment health provides information for purpose, on from human of material for biology, and microbiology, and Immunology, and biochemistry, and blood Immunology, and blood learn, and biological physics, and cytology, test of clinical two level subject, its laboratory work has to clinical provides test information Advisory (including test results explained and for further appropriate check provides recommends), and participation clinical 体指数输出格式:t=%.2fn 为避免出现格式错误,请直接拷贝粘贴题目中给的格式字符串和提示信息到你的程序中。 时间限制:500ms内存限制:32000kb #include s
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1