问题 问答题

下面的程序是求9999以内的“完全数”。所谓完全数是指这样的自然数:它的各个约数(不包括该数自身)之和等于该数自身。如28=1+2+4+7+14就是一个完全数。请在程序的每条横线处填写一个语句,使程序的功能完整。 注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。 public class QuanShu{public static void main(String args[]){ for(int n=l;n<9999;n++) if(______________)System.out.println(n); } public static iht divsum(int n){//该方法功能是求一个数的所有约数int s=0; for(int i=l;i<n;i++) if(_________________) __________________ return s; } }

答案

参考答案:

解析:n==divsum(n) n%i==0 s+=i; 本题考查for循环语句、求余运算符(%)和Java语言的方法的使用。解答本题的关键是熟悉使用for循环语句。在本题中,if(n==divsum(n))语句是用来调用divsum(n)方法(其中n为方法的实际参数)和判断某个自然数是否为“完全数”。n%i==0是用来判断数n是否能被数i整除, s+=i;是用来累加某个自然数的所有约数。

完形填空
In 1898 an 8.2 earthquake almost flattened America, killing over 30,ooo people in less than four minutes. In the middle of complete damage and disorder, a father rushed to the school where his son was supposed to be,  26  that the building was  2 7.
After the unforgettably shock, he 28  the promise he had made to his son: “ No matter  29 happens, I’ll always be there for you!” And tears began to 30 his eyes. As he looked at the pile of ruins, it looked hopeless, but he kept remembering his 31  to his son. He rushed there and started 32 the ruins.
As he was digging, other helpless parents arrived , 33 : “It’s too late ! They are all dead! 34  , face reality; there’s nothing you can do!” To each parent he responded with 35 : “Are you going to help me now? ”No one helped. And then he continued to dig for his son, stone by stone.
Courageously he went on alone because he needed to know 36 : “Is my boy 37 or he is dead?” He dug for eight hours … 12 hours…36 hours…then , in  38  hour , he pulled back a large stone and heard his son’s 39 . He screamed his son’s name, “ARMAND!” He heard back, “Dad!?! It’s me, Dad! I told other kids not to worry.  I told them that if you were alive, you 40 me and 41 you saved me, they’d be saved. You promised, ‘No matter what happens, I’ll always be there for you!’ You did it, Dad!”
“What’s going on in there? ”the father asked
“There are 14 of  us  42 43  33,Dad. We’re scared, hungry, thirsty and thankful you are here. When the building collapsed, it made  44  , and it saved us.”
“Come out , boy!”
“No, Dad! Let the other kids out first, 45 I know you’ll get me! No matter what happens, I know you’ll always be there for me!”
小题1:
A.only discoveringB.only to discoverC.only realizingD.only to realize.
小题2:
A.as flat as a pancakeB.as high as a mountain
C.as strong as an ox D.as weak as a kitten
小题3:
A.memorized B.forgotC.keptD.remembered
小题4:
A.whatB.that C.whichD.who
小题5:
A.fillB.fill in C.comeD.burst
小题6:
A.pictureB.promiseC.presentD.encourage
小题7:
A.diggingB.digging throughC.digging outD.digging into
小题8:
A.to sayB.saidC.and sayingD.saying
小题9:
A.Come outB.Come againC.Come onD.Come off
小题10:
A.one wordB.one soundC.one rowD.one line
小题11:
A.for himselfB.of himselfC.by himselfD.to himself
小题12:
A.liveB.livingC.aliveD.lively
小题13:
A.38B.the 38C.38thD.the 38th
小题14:
A.soundB.voiceC.noiseD.tone
小题15:A will save       B. would  save   C. save          D. would have saved
小题16:
A.ifB.because C.even ifD.though
小题17:
A.remainedB.missingC.leftD.gone
小题18:
A.forB.behindC.out ofD.over
小题19:
A.a promiseB.spaceC.roomD.a triangle
小题20:
A.becauseB.thoughC.whenD.even though
问答题