2013年7月C语言补考参考答案.docx
2分include<stdio.h>voidmain()intk,sum=0;for(k=l;k<=10;k+sum+=k*k;Printf("sum=%dn”,sum);3.(10分)源程序:Sinclude<stdio.h>voidmain()inta10,x,f,k;一printf("Inpu(:");for(k=0;k<10;k+)scanf(',%d"ak);printf("Inputyouwanttofind:");scanf("%d",&x);Jf=0;for(k=();k<l();k+)if(x=ak)2分f=l;breakjJif(f)fbr(;k<l();k+)ak=ak+l;a9=0;2分for(k=0;k<9;k+)printf(',%3d,ak)rintf(',n,');1分elseprintf("Notfoundn");分20122013学年第二学期程序设计基础(C)课程考试试卷参考答案一、单项选择题(每小题2分,共40分)题号12345678910答案ABAADADBCC迎号11121314151617181920答案BDDDABBCBD二、填空题(每空1分,共15分)1.a2.013.float4.选择结构、循环结构5.非零(或1)6.连续的,入口地址(或首地址)7.传送值和传送地址8.外部变量9._2_10,文本文件和二进制文件三、判断题(每小题1分,共5分)1.×2.3.4.5.四、程序阅读填空题(共20分)1. (6分)Inain:a=3,b=4SUb:a=6,b=7main:a=3,b=42. (6分)5,93. (8分)(1)0(2)10000(3)i+÷(4)(i*10+7)%3=01分五、编程题(共20分)1.(5分)源程序:include<stdio.h>voidmain()floatgrade;printf(wInputascanf(rt%fw,ftgrade);if(gradc>=90)printf(Anw);elseif(grade>=80)printf(mB11m);elseif(grade>=60)printf("Cn");elsePrintf("Dn”);)2.(5分)源程序: