当运行测试输入6789时,写出下面Python程序的执行结果。num=int(input(“请输入一个整数:”))while(num!=0): print(num%10,end=' ‘ ) num=num//10
举一反三
- 中国大学MOOC: 当输入是4321时,下面程序的输出结果是______。 num = input(请输入一个整数:) while num != 0: print(num % 10) num = num // 10
- 当输入是4321时,下面程序的输出结果是______。 num = input("请输入一个整数:") while num != 0: print(num % 10) num = num / 10 A: 4321 B: 4321 C: 1234 D: 1234
- 有如下程序,输入一个int型的整数num,逆向输出其各位数字,同时求出其各位以及各位数字之和。 #include#includevoid main() { int num,sum=0,k,i=0; cin>;>;num; while(num>;0) { (1) ; cout<; A: k=num%10 num=num/10 B: num=num%10 k=num/10 C: num=num/10 k=num%10 D: k=num/10 num=num%10
- num=float(input('输入一个数字:\n'))<br/>num=int(num)<br/>num=int((num+5)/2)<br/>num=num*2-5<br/>num=int(num%5)<br/>print(num)输入:14.5输出:______
- Function fun(ByVal num As Long) As Long Dim k As Long k = 1 num = Abs(num) Do While num k = k * (num Mod 10) num = num \ 10 Loop fun = k End Function Private Sub command1_click() Dim n As Long, r As Long n = Val(InputBox("请输入一个数:")) r = fun(n) Print r End Sub 程序运行后,单击命令按钮,输入1234,输出结果为:( )