首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设a、b都是自然数,为求a除以b的余数,某人编写了以下函数: Function fun(a As Integer,b As Integer) While a>b a=a-b Wend fun=a End Function 在调试时发现函数是错误的。为使函数
设a、b都是自然数,为求a除以b的余数,某人编写了以下函数: Function fun(a As Integer,b As Integer) While a>b a=a-b Wend fun=a End Function 在调试时发现函数是错误的。为使函数
admin
2010-04-08
35
问题
设a、b都是自然数,为求a除以b的余数,某人编写了以下函数:
Function fun(a As Integer,b As Integer)
While a>b
a=a-b
Wend
fun=a
End Function
在调试时发现函数是错误的。为使函数能产生正确的返回值,应做的修改是
选项
A、把a=a-b改为a=b-a
B、把a=a-b改为a=a\b
C、把While a>b改为While a
D、把While a>b改为While a>=b
答案
D
解析
当a=b时,余数应该为0,而不是a,程序执行结果会跳出循环使fun=a,应该继续循环,正确答案为D)。
转载请注明原文地址:https://jikaoti.com/ti/K6g0FFFM
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
对下列程序的叙述中,正确的是 1:publicclassXextendsThreadimplementsRunnable{ 2:publ主cvoidrun(){ 3:System.out.println(“thisisru
Java程序默认引用的包是
Java的反汇编命令是
下列命令中,以下()命令能为远程对象生成stub和skeleton。
下面代码段的输出是()。if(5&7)0&&5|2)system.out.println("true");
JDK中,用()命令对其源文件进行编译,生成字节码文件。
假设有Stringa="A";charb=’A’;charc=65,下面选项中正确的是( )。
数据库DB、数据库系统DBS、数据库管理系统DBMS之间的关系是( )。
在关系数据库中,用来表示实体之间联系的是
在软件设计中,不属于过程设计工具的是
随机试题
下列选项中,属于谚语的是
患者,女,65岁。右上腹隐痛半年伴有进行性黄疸、陶土样便1个月余。既往有胆石症、胆囊炎病史。提示:查体:巩膜重度黄染,腹部稍膨隆,腹软,上腹部压痛明显,Murphy征阳性,肠鸣音减弱。应考虑的临床诊断有1.胆石症2.胆囊炎3.胆囊癌4.胆管癌
该患者可能的诊断为为进一步明确诊断,该患应首先做的检查是
患者男性,35岁,20天前因车祸致右股骨干骨折,经内固定手术治疗,2小时前突然出现呼吸困难,右侧胸痛,伴有小量咯血,自感恐惧不安,查体右肺有少量哮鸣音
男性,38岁,慢性咳嗽12年,活动后气急3年,下列哪项对诊断阻塞性肺气肿最有价值
()的决定具有“准仲裁”的性质,合同双方应遵照执行。
孟子是中国古代私学的开创者。()
随机变量X的密度为f(x)=,一∞<x<∞,则A=________。
Now,morethanever,itdoesn’tmatterwhoyouarebutwhatyoulooklike.Janetwasjusttwenty-fiveyearsold.Shehada
______aholiday,wewenttothefarmtohelpthefarmerswiththeirharvest.
最新回复
(
0
)