问题 单项选择题

用程序计算一个整数的各位数字之和,在下划线处应填写的语句是( )。 SET TALK OFF INPUT "X=" TO X S=0 DO WHILE X! =0 S=S+MOD(X, 10) ENDDO s SET TALK ON

A.X=int(X/10)

B.X=int(X%10)

C.X=X-int(X/10)

D.X=X-int(X%10)

答案

参考答案:A

解析: 首先用户输入一个数字保存到变量X中,使用一个DO WHILE循环语句来累加各位数字之和,判断条件是变量X是否等于0,如果为0,则退出循环,否则通过求余函数MOD得到变量X的个位数。因为题意要求计算各位数字之和,所以接下来应当将变量X除以 10并取整,使之缩小10倍,以便将变量X的十位数变成个位数,然后再次循环计算。

完形填空
完形填空。
     Some people just can not decide what to do all by themselves. They often __1__ the advice (建议) of
  their friends. But they never do as their friends have said. My friend Jack is __2__  person, and he is
  always asking me for help. I try to help him as well as I can, but he never listens to me. Yesterday I
  __3__ a new way to make him take my advice. It worked. "Look," he said __4__ me a letter. "What do
  you think I should do? " The letter told him that there was a good job for him. It seemed to be a good
  chance (机会) for a young artist. His teacher __5__ him to Australia to work. The job would pay very
 __6__ , and he __7__ to travel and visit many interesting places. " __8__ this, Rose?" he asked, " If I
 take the job, I will have to stay in Australia for two years. I may stay a bit longer. But it would be a
 wonderful time for me. Should I go, Rose?"
     "Don't go," I told him, "You'll suffer (受苦) a lot there." "Don't go?" he __9__ surprised at my answer. 
  As you have probably known, Jack went. I wonder (想知道) __10__ he found that I really wanted him
  to take the job.
( ) 1. A. ask for          
( ) 2. A. such kind        
( ) 3. A. thought          
( ) 4. A. showing          
( ) 5. A. will send        
( ) 6. A. good               
( ) 7. A. could be able
( ) 8. A. What do you like   
( ) 9. A. asked           
( ) 10. A. why               
B. receive      
B. this kind    
B. tried      
B. showed        
B. send        
B. well        
B. could          
B. How do you like
B. spoke      
B. whether      
C. take            
C. such a          
C. gave            
C. to show          
C. would send        
C. nice            
C. would be able
C. How do you think of
C. said            
C. that            
D. give                
D. a such              
D. wanted              
D. shown              
D. sends              
D. enough              
D. would be going      
D. What do you think  
D. looked              
D. when                
单项选择题