【程序说明】程序功能是若输入的N值为5,则输出结果如下:11 11 2 11 3 3 11 4 6 4 1【程序】SET TALK OFFCLEARINPUT“N=”TO NDIME A(N,N)P=NDO WHILE N>0A(N,N)=1(5)N=N-1ENDDOFOR I=3 TO (6)FOR J=2 TO I-1A(I,J)= (7)ENDFORENDFORFOR I=1 TO P? SPACE(3*(P-I+1))FOR J=1 TO I?? STR(A(I,J),3)(8)?ENDFORSET TALK ON(5)A.A(1,N)=1B.A(1,N-1)=1C.A(N,1)=1D.A(N-1,1)=1
【程序说明】程序功能是若输入的N值为5,则输出结果如下:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
【程序】
SET TALK OFF
CLEAR
INPUT“N=”TO N
DIME A(N,N)
P=N
DO WHILE N>0
A(N,N)=1
(5)
N=N-1
ENDDO
FOR I=3 TO (6)
FOR J=2 TO I-1
A(I,J)= (7)
ENDFOR
ENDFOR
FOR I=1 TO P
? SPACE(3*(P-I+1))
FOR J=1 TO I
?? STR(A(I,J),3)
(8)
?
ENDFOR
SET TALK ON
(5)
A.A(1,N)=1
B.A(1,N-1)=1
C.A(N,1)=1
D.A(N-1,1)=1
相关考题:
以下程序的输出结果是( )。main( ){ int i,a[4][4]={{1,3,5),{2,4,6},{3,5,7}};printf(%(1%d%d%d\n.a[O][3],a[1][2],a[2] [1],a[3][0]);}A.0650B.1470C.5430D.输出值不定
以下程序的输出结果是( )。 main( ) { int i,a[4] [4]一{{1,3,5),{2,4,6},{3,5,7}}; printf("%(1%d%d%d\n".a[O][3],a[1][2],a[2] [1],a[3][0]; }A.0650B.1470C.5430D.输出值不定
有如下程序段:intt[][3]={1,2,3,4,5,6,7,8,9,10,11,12};printf("%d\n",t[2][1]);则执行该程序段后输出结果是() A.8B.7C.4D.2
若有如下程序: main() {int a[3][4]={1,2,3,4,5,6,7,8,9}; printf("%d%d%d\n",a[0][1],a[1][2],a[2][3]); } 则程序运行后的输出结果是( )A.270B.480C.160D.不定值
设有如下程序段,则a[1].c 的值为________。 Struct u { int a; int b; float c; } a[2]={1,2,3,4,5,6};A.1B.3C.4D.6
12、以下程序的执行结果是 set1 = {1, 2, 3} set2 = set1.copy() set2.add(4) print(set1)A.{1, 2, 3, 4}B.{1, 2, 3}C.NoneD.程序报错
设有如下程序段,则a[1].c 的值为 。 Struct u { int a; int b; float c; } a[2]={1,2,3,4,5,6};A.1B.3C.4D.6