3、请写出如下程序的输出结果和运行原理: n = 1 while n <= 100: print(n) n = n + 1 print('END')

3、请写出如下程序的输出结果和运行原理: n = 1 while n <= 100: print(n) n = n + 1 print('END')


参考答案和解析
1G 1G3G 1G3G5G 1G3G5G7G 1G3G5G7G9G

相关考题:

有如下事件过程:Private Sub Command1_Click()Dim m As Integer, n As Integerm=2: n=1Print "m="; m; "n="; nCall TOD(m, n)Print "m="; m; "n="; nEnd SubSub TOD(x, y)x=x ^ 2y=y ^ 3End Sub程序运行后,输出的结果为( )。A.m=2,n=1m=1,n=2B.m=2,n=1m=4,n=1C.m=1,n=2m=1,n=4D.m=1,n=2m=2,n=4

单击命令按钮时,下列程序的运行结果为Private Sub Command1_Click()Print Fun(23,18)End SubPublic Function Fun(m As Integer,n As Integer) As IntegerDO While m<>nDO While m>n:m=m-n:LoopDO While m<n:n=n-m:LoopLoopFun=mEnd FunctionA.0B.1C.3D.5

有如下程序; Private SubForm_Click() Dim check As Boolean,n As Integer check=False n=0 Do Do While n<10 n=n+1 If n=5 Then check=True Exit Do End if Print n; Loop Loop Until check = True End Sub 程序运行后,输出的结果是 ______ 。A.1 2 3B.1 2 3 4C.1 2 3 4 5D.1 2 3 4 5 6

假定有如下事件过程: Privte Sub Form_Click0 Dim x As Integer,n As Integer x=1 n=0 Do While x<28 x=x*3 n=n+1 Loop Print x,n End Sub 程序运行后,单击窗体,输出结果是( )。A.81 4B.56 3C.28 1D.243 5

下面程序的运行结果为 include Class Astatic int n; public: A( ) {n=1;} A(int n 下面程序的运行结果为#include<iostream.h>Class Astatic int n;public:A( ) {n=1;}A(int num) {n=num;}void print( ) {cout < < n;}};int A: :n=2;void main( ){A a,b(3) ;a. print( ) ;b. print( ) ;cout < < endl;}A.11B.13C.23D.33

单击命令按钮时,下列程序的运行结果为 Private Sub Command1_Click() Print Fun(23,18) End Sub Public Function Fun(m As Integer,n As Integer)As Integer Do While m<>n Do While m>n:m=m-n:Loop Do While m<n:n=n-m:Loop Loop Fun=m End FunctionA.0B.1C.3D.5

(25)下列程序的运行结果是 。 Private Function myfun(m,n) Do While mn Do While mn:m=m-n:Loop Do While nm:n=n-m:Loop Loop myfun=m End Function Private Sub Command1_Click() Print myfun(9,8) End SubA.2 B.1 C.4 D.3

有如下事件过程: Private Sub Command1_Click( ) Dim m AS Integer,n AS Integer m=2:n=1 Print "m=";m;"n=";n Call TOD(m,n) Print "m=";m;"n=";n End Sub Sub TOD(x,y) x=x^2 y=y^3 End Sub 程序运行后,输出的结果为A.m=2,n=1 m=1,n=2B.m=2,n=1 m=4,n=1C.m=1,n=2 m=1,n=4D.m=1,n=2 m=2,n=4

下列程序的运行结果是( )。 Private Function myfun(m,n) Do while mn Do While mn:m=m-n:Loop Do Wllile nm:n=n-m:Loop Loop myfun=m End Function Private Sub Command1_Click( ) print myfun(9,8) End SubA.2B.1C.4D.3

以下能够正确计算n!的程序是A.Private Sub Command1_Chck( ) n=5:x=1 Do x=x*i i=i+1 Loop While i<n Print x End SubB.Private Sub Command1_Click( ) n=5:x=1:i=l Do x=x*i i=i+1 Loop While i<n Print x End SubC.Private Sub Command1_Click( ) n=5:x=1:i=l Do x=x*i i=i+1 Loop While i<=n Print x End SubD.Private Sub Command1_Click( ) n=5:x=1:i=l Dox=x*i i=i+1 Loop While i>n Print x End Sub

以下能够正确计算n!的程序是A.Private Sub Command1 Click() n=5:x=1 Do x=x * I I=I + 1 Loop While I < n Print x End SubB.Private Sub Command1_Click() n=5:X=1:I=1 Do X=X*I I=I + 1 Loop While I <n Print x End SubC.Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I<=n Print X End SubD.Private Sub Command1_Click() n=5:X=1:I=1 Do x=x * I I=I + 1 Loop While I>n Print X End Sub

以下能够正确计算n! 的程序是( )。A.Private Sub Command1_Click( ) n=5:x=l Do x=x*i i=i+1 Loop While i < n Print x End SubB.Private Sub Command1_Click( ) n=5:x=1:i=1 Do x=x*i i=i+1 Loop While i < n Print x End SubC.Private Sub Command1_Cliek( ) n:5:x=1:i=1 Do x=x* i i:i+1 Loop While i < = n Print x End SubD.Private Sub Command1_Cliek( ) n=5:x:1:i=1 Do x=x*i i=j+1 Loop While i > n Print x End Sub

下列程序段的运行结果是( )。 Subsele() Dim n As Integer i=21:n=3 Do While i>n i=i-n Loop Print i End SubA.2B.4C.5D.3

单击命令按钮时,下列程序的运行结果为Private Sub Command1_Click( ) Print MyBM(23,18)End SubPublic Function MyBM(m As Integer,n As Integer)As Integer Do While m n Do While m > n:m=m - n:Loop Do While m < n:n=n - m:Loop Loop MyBM=mEnd FunctionA.0B.1C.3D.5

单击命令按钮时,下列程序代码的运行结果为 Private Sub Command1_Click() print MyFunc(20,18) End Sub Public Function MyFunc (m As Integer,n As Integer)As Integer Do While m n Do While m > n:m=m - n:Loop Do While m < n:n=n - m:Loop Loop MyFunc=m End FunCtionA.0B.2C.4D.6

以下能够正确计算n!的程序是A.Privas Sub Command1_Click() n=5:x=1 Do x=x*i i=i+1 Loop While i<n Print x End SubB.Private Sub Command1_Click() n=5:x=1:i=1 Do x=x*i i=i+1 Loop While i<n Print x End SubC.Private Sub Command1_Click() n=5:x=1:i=1 Do x=x*i i=i+1 Loop while i<=n Print x End SubD.Private Sub Command1_Click() n=5:x=1:i=1 Do x=x*i i=i+1 Loop While i>n Print x End Sub

下面程序的运行结果为include class A{ static int n;public:A( ){n=1;}A(int nu 下面程序的运行结果为 #include < iostream.h > class A { static int n; public: A( ){n=1;} A(int num){ n = num;} void print( ){cout<< n;} }; int A::n=2; void main( ) { A a,b (3); a.print( ); b.print( ); cout<< end1; }A.11B.13C.23D.33

若有以下程序: include usingnamespace std; class Sample { private: const int n; 若有以下程序:include <iostream>using namespace std;class Sample{private:const int n;public:Sample(int i) :n(i) {)void print(){cout<<"n="<<n<<end1;}};int main(){sample a(10);a.print();return 0;}上述程序运行后的输出结果是【 】。

下面程序的运行结果是 ______ 。程序的功能是 _______ 。Public Function myfun(m,n)Do while m>nDo while m>n:m=m-n:LoopDo While n>m:n=n-m:LoopLoopMyfun=mEnd FunctionPrivate Sub Command1_Click()Print myfun(15,15)End Sub

下列程序段的运行结果是( )。 Sub sele() Dim n As Integer i=21: n=3 Do While i > n i=i-n Loop Print i End SubA.2B.4C.5D.3

单击命令按钮时,下列程序的运行结果为 Private Sub Command1_Click( ) Print Fun(23, 18) End Sub Public Function Fun(m As Integer, n As Integer) As Integer Do Whilem <> n Do While m > n : m--m - n: Loop Do While m < n : n=n - m: Loop Loop Fun =m End FunctionA.0B.1C.3D.5

下列程序的运行结果是( )。 Private Function myfun(m,n) Do While m>n Do While m>n:m=m-n:Loop Do While n>m:n=n-m:Loop Loop myfun=m End Function Private Sub Command1_Click() Print myfun(9,8) End SubA.2B.1C.4D.3

下列程序的运行结果是( )。Private Function myfun(m,n)Do While mnDo While mn:m=m-n:LoopDo While nm:n=n-m:LoopLoopmy fun=mEnd FunctionPrivate Sub Command1_Click()Print myfun(9,8)End SubA.2B.1C.4D.3

下列程序的运行结果是( )。 Private Function myfun(m, n) Do While m > n Do While m>n:m=m-n:Loop Do while n>m:n=n-m:Loop Loop myfun=m End Function Private Sub Command1_Click() Print myfun(9, 8) End SubA.2B.1C.4D.3

下列程序的运行结果是( )。Private Function myfun(m,n)Do while mnDo While mn:m=m-n:LoopDo While nm:n=n-m:LoopLoopmyfun=mEnd FunctionPrivate Sub Command1_Click( )print myfun(9,8)End SubA.2B.1C.4D.3

下面程序的运行结果为includeclass A{static int n;public: A(){n=1;} A(intnum){n 下面程序的运行结果为 #include<iostream.h> class A { static int n; public: A(){n=1;} A(intnum){n=num;} void print(){cout <<n;} }; int A∷n=2; void main() { Aa,b(3); a.print(); b.print(); cout <<end1; }A.11B.13C.23D.33

以下能够正确计算n!的程序是______。A.Private Sub Commeadl_Click() n=5: x=1 Do x=x*i i=i+1 Loop While i<n Print x End SubB.Private Sub Command1_Click() n=5: x=1: i=1 Do x=x*i i=i+1 Loop While i<n Print x End SubC.Private Sub Command1_Click() n=5: x=1: i=1 Do x=x*i i=i+1 Loop Whilei<=n Print x End SubD.Private Sub Commsndl_Click() n=5: x=1: i=1 Do x=x*i i=i+1 Loop While i>n Print x End Sub

执行以下程序段,如果在对话框中输入8,输出结果是"Hello"的是______。A.n = InputBox("请输入一个数") Select Case n Case 7 To 1 Print "Hello" End SelectB.n = InputBox("请输入一个数") Select Case n Case Is>1, Is < 6 Print "Hello" End SelectC.n = InputBox("请输入一个数") Select Case n Case Is > 5, 1, 3 To 10 Print "Hello" End SelectD.n=InputBox("请输入一个数") Select Case n Case 1, 5, Is > 9 Print "Hello" End Select