下列程序的输出结果是: num = 16 while Ture: if num <12 and num >=10: print (num) break num = num – 2 print (num)A.10B.12C.14D.16
下列程序的输出结果是: num = 16 while Ture: if num <12 and num >=10: print (num) break num = num – 2 print (num)
A.10
B.12
C.14
D.16
参考答案和解析
B 当num=0时,循环成立,执行num++后;num的值为1,因此输出1,接着返回while中的表达式;当num=1时,循环成立,执行nHm++后,num的值为2,输出2,再返回while中的表达式;当num=2时,循环成立,执行num++后.nHm的值为3,输出3,最后返回while中的表达式,当num=3,循环不成立,退出。
相关考题:
以下程序的输出结果是【18】。unsigned fun6(unsigned num){ unsigned k=1;do{k *=num;num/=10;}while (num);return k;}main(){ unsigned n=26;printf("%d\n", fun6(n));}
下面程序的运行结果为【 】。class A} public:int num;A(int i){num=i;}A(A a){num=++a.num;}void print(){cout<<num;}};void main(){A a(1),b(a);a.print();b.print();}
下面程序的运行结果为includeclass A{int num;public:A(int i){num=i;}A(A a) 下面程序的运行结果为 #include<iostream.h> class A { int num; public: A(int i){num=i;} A(A a) { num = a.num+ +;} void print( ) {cout << num;} }; void main( 0 { A a (1),b (a) ; a.print( ); b.A.11B.12C.21D.22
下面程序的运行结果为 include class A {int num; public: A(int) {num=i;} A(A public:A(int) {num=i;}A(A a) {hum=a. num++;}void print( ) {cout < < num;}};void main( ){A a(1) ,b(a) ;a. print( ) ;b. print( ) ;}A.11B.12C.21D.22
下面程序的运行结果为#include(iostream. hclass A{int num;public:A(int i){num=i;}A(A a){num=a. num++;}void print(){cout};void main(){A a(1),b(a);a. print();b.print();A.11B.12C.21D.22
下面程序的运行结果是#includevoid main(){int num=1;int ref=num:ref=ref+2;cout(num;num=num+3;cout}A.13B.16C.36D.33
(26)编写下列事件过程和函数过程Private Sub Command1_Click() Dim num(1 TO 6)As Single Num(1)=103:Num(2)=190:Num(3)=0: Num(4)=32:Num(5)=-56:Num(6)=100: Print Print p2(6,num()) End Sub Private Function p2(By Val n Integer,number()As Single)As Integer P2=number(1) For j=2 To n If number(j)p2 Then p2=number(j) Next j End Function 程序运行后,在窗体上输出 A.-56 B.0 C.103 D.190
下面程序的输出结果是______。 unsigned fun(unsigned num) { unsigned k=1; do{ k*=num%10; num/=10; }while(num); return(k); } main() { unsigned n=26; printf("%d\n",fun(n)); }A.0B.4C.12D.无限次循环
以下程序的输出结果是【】。 include unsigned fun (unsigned num) {unsigned k=1; do{ 以下程序的输出结果是 【 】 。include<iostream.h>unsigned fun (unsigned num){unsigned k=1;do{k*=num%10;num/=10;} while(num);return k;}void main( ){ unsigned n=26;cout <<fun(n) <<end1
执行下列命令,正确的输出结果是( )。 STORE—123.456 TO NUM?”NUM=”+STR(NUM,8,3)A.123.456SXB 执行下列命令,正确的输出结果是( )。 STORE—123.456 TO NUM?”NUM=”+STR(NUM,8,3)A.123.456B.—123.456C.NUM=—123.456D.NUM=123.456
以下程序的输出结果是【】。include unsigned frn(ullsigned num) { unsi9ned k=1; do{ 以下程序的输出结果是【 】。include<iostream.h>unsigned frn(ullsigned num){ unsi9ned k=1;do{k*=num%10;num/=10;} while(num);return k;}void main(){ unsigned n=26;cout<<fun(n) <<endl;}
以下程序的输出结果是 ______。 main() {int num=0; while(num<=2) {num++;printf("%d\n",num);} }D.1 1 1 1 2 2 2 3 3 4
下列程序段运行结果是______。Dim c As Integer,num As IntegerNum=29483Doc=num Mod 10Print c;num=num\10Loop While num<>0
以下程序的输出结果是unsigned fun6(unsigned num){ unsigned k=1; do{k *=num%10;num/=10;} while (num); return k;}main(){ unsigned n=26; printf("%d\n", fun6(n));}
以下程序的输出结果是______。 main() {int num=0; while(num<=2) { num++; printf("%d\n",num); } }A.1 2 3 4B.1 2 3C.1 2D.1
下面程序的运行结果为includeclass A{ int num;public: A(int){num=i;} A(ABm){num 下面程序的运行结果为 #include<iostream.h> class A { int num; public: A(int){num=i;} A(ABm){num=a.num++;} void print(){cout<<num;} }; void main() { Aa(1),b(a); a.print(); b.print(); }A.11B.12C.21D.22
以下程序的输出结果是( )。main( ){ int num=0;while(num=2){ num++;printf(”%d\n”,num); }}A.1B.1 2 3C.1 2 3 4D.1 2 2 3
请读程序: includemain(){int num=0;while(num 请读程序: # include<stdio.h> main( ) {int num=0; while(num<=2) {num+ +;printf("%d\n",num);} } 上面程序的输出结果是 ( )A.1B.1 2C.1 2 3D.1 2 3 4
编写如下事件过程和函数过程: Private Sub Command1_Click() Dim num(1 To 6)As Single num(1)=103:num(2)=190:num(3)=0 num(4)=32:num(5)=-56:num(6)=100 Print Print p2(6,num()) End Sub Private Function p2(By Val n As Integer, number() As Single) As Integer p2=number(1) For j=2 To n If number(j)<p2 Then p2=number(j) Next j End Function 程序运行后,在窗体上输出( )。A.-56B.0C.103D.190
填空题以下程序段的输出结果是()。 num=0 Do While num<=2 num=num+1 Loop Print num