下列函数过程的作用是计算x和y的最大公约数。请填空。Private Sub Command1_ Click()Dim x As Integer, y As Integer, Result As Integerx = InputBox (“请输入第一个数”)y = InputBox (“请输入第二个数”)Result =______Print x; "和"; y; "的最大公约数为: "; ResultEnd SubPrivate Function GYS (ByVal A As Integer, ByVal B As Integer)Dim T As IntegerT = A Mod BDo While ______A = BB = TT = A Mod BLoop______End Function
下列函数过程的作用是计算x和y的最大公约数。请填空。
Private Sub Command1_ Click()
Dim x As Integer, y As Integer, Result As Integer
x = InputBox (“请输入第一个数”)
y = InputBox (“请输入第二个数”)
Result =______
Print x; "和"; y; "的最大公约数为: "; Result
End Sub
Private Function GYS (ByVal A As Integer, ByVal B As Integer)
Dim T As Integer
T = A Mod B
Do While ______
A = B
B = T
T = A Mod B
Loop
______
End Function
相关考题:
下面的程序是计算给定函数的值,自变量x,y的值用InputBox函数输入,函数如下:f(x,y) =程序不完整,请填空,将程序的补充完整。Option ExplicitDim x As SingleDim y As SingleDim z As SinglePrivate Sub Command1_Click()x=Val(InputBox("x=") )y=Val(InputBox("y=") )End SubPrivate Sub Command2_Click()If 【13】 Thenz=x ^ 2 + y ^ 2ElseIf 【14】 Thenz=x ^ 2 - 2 * y ^ 2【15】z=y ^ 2 - 3 * x ^ 2End IfForm1.Print "当x,y的值为:"; x, yForm1.Print "f(x,y) 的值为:"; zEnd Sub
阅读下列程序说明和c代码,将应填入(n)处的字句写在对应栏内。[说明]下面的程序利用递归算法计算x和y的最大公约数。[函数2.1]main ( ){ int x,y,k,t;scanf(" % d% d" , x, y);if(x>y) { t=x;x=y; y=t;}(1);while(k! =0){y=x;(2);k=y%x;}prinff( "% d" ,x); }[函数2.2说明]函数fun(char *str,char *substr的功能是计算子串sugbstr在串str中出现的次数。[函数2.2]fun(ehar * str, char * substr){ int x,y,z;(3);for(x=0;str[ x] ! = '\O';x + + )for(y=x,z=0;sabstr[z] = =str[y];(4),y+ +)if((5)= ='\0') {num + +;break;}return(num);}
下列程序的功能是:当x100时,没有意义。请填空。 Private 下列程序的功能是:当x<50时,y=0.8×x;当50≤x≤100时,y=0.7×x;当x>100时,没有意义。请填空。Private Sub Command1_Click()Dim x AS Singlex=InputBox("请输入x的值!")________Case Is<50y=0.8*xCase 50 To 100y=0.7*K__________Print"输入的数据出界!"End SelectPrint x,yEnd Sub
下述程序计算从键盘输入的两个数的最大公约数,请填空。(答案中请不要带空格,答案之间用3个空格键间隔) #include<iostream> #include<iomanip> using namespace std; void main() { int x, y, r, gcd; cout<<"Enter two number: n "; cin>> x>>y; r= ; while () { x=y; y=r; r= ; } cout<<"The result is "<<y<<endl; }
3、下述程序计算从键盘输入的两个数的最大公约数,请填空。(答案中请不要带空格,答案之间用3个空格键间隔) #include<iostream> #include<iomanip> using namespace std; void main() { int x, y, r, gcd; cout<<"Enter two number: \n "; cin>> x>>y; r= ; while () { x=y; y=r; r= ; } cout<<"The result is "<<y<<endl; }