• 2022-10-29
    下面程序的输出结果是( )。 n = 1 while n < 6: if n == 3: print(" ",end=' ') else: print(n,end=' ') n = n + 1
  • 内容

    • 0

      n=0 while n<=10: n=n+1 if n==3: continue if n>8: break: print(n) else: print("正常结束") 分析:print命令执行了______次,n最终值为______。else部分print命令执行了______次

    • 1

      以下程序不正确的是 ( ) A: n=input('n=')switch rem(n,3)case 0; A=3*ncase 2; A=2*ncase 1; A=n end B: n=input('n=')if rem(n,3)==0; A=3*n elseif rem(n,3)==2; A=2*n else A=n end end C: n=input('n=')if rem(n,3)==0; A=3*nelseif rem(n,3)==2; A=2*nelse A=n end D: n=input('n=')switch rem(n,3)case 0; A=3*ncase 2; A=2*notherwise; A=n end

    • 2

      题目:将一个正整数分解质因数。例如:输入90,打印出90=2*3*3*5. n = int(input("input number:")) print ("n = %d" % n) for i in range(2,n + 1): while __________ if n % i == 0: print(str(i)) print("*") n = n / i else: break print( "%d" % n)

    • 3

      声明一个变量为局部变量应该用( )。 A: Private Sub Command1 Click() n=5:x=1 Do X=X * I I=I + 1 Loop While I < n Print x End Sub B: 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 C: 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 D: 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

    • 4

      编写如下程序: Private Sub Command1_Click; Dim m As Integer, n As Integer m = 2 : n = 1 Select Case m Case 1 Select Case n Case 1 Print "AAA" Case 2 Print "BBB" End Select Case 2 Print "CCC" End Select End Sub 程序运行后,单击命令按钮Command1,输出结果为 A: BBB B: CCC C: AAA D: 1