下列程序将一个数组的元素逆序重新存放,例如存放顺序为: 8,6,5,4,1 。要求改为: 1,4,5,6,8。请在横线处填写适当语句,使程序完整。 INTEGER, PARAMETER::N = 5 INTEGER A( N ), I, T DATA A/8,6,5,4,1/ WRITE( *, 10 )( A( I ), I = 1, 5 ) DO I = 1, N / 2 T = A( I ) ______ ______ END DO WRITE( *, 10 )( A( I ), I = 1, 5 )10 FORMAT( 1X, 5I4 )END
举一反三
- 下列程序完成按以下格式打印杨辉三角形的前N行: 1 1 1 1 2 1 1 3 3 11 4 6 4 1请在横线处填写适当语句,使程序完整。 PARAMETER( N = 10 ) INTEGER A( N, N ), I, J DO I = 1, N ______ END DO DO I = 3, N DO J = 2, I - 1 ______ ENDDO END DO DO I = 1, N WRITE( *, 10 )( A( I, J ), J = 1, I ) END DO10 FORMAT( 1X, 10I5 )END
- Public Sub Proc(a%( )) Static i% Do a(i) = a(i) + a(i + 1) i = i + 1 Loop While i < 2 End Sub Private Sub Command1_Click( ) Dim m%, i%, x%(10) For i = 0 To 4: x(i) = i + 1: Next i For i = 1 To 2: Call Proc(x): Next i For i = 0 To 4: Print x(i);: Next i End Sub A: 3 4 7 5 6 B: 3 5 7 4 5 C: 2 3 4 4 5 D: 4 5 6 7 8
- for (int i = 1; i <= 10; i++){ if (i % 5 != 0) continue; Console.WriteLine("{0}", i); }该段程序执行后输出_____。 A: 5 10 B: 1 2 3 4 6 7 8 9 C: 5 D: 1 2 3 4 5 6 7 8 9 10
- 阅读程序: Option Base 1 Sub P(b() As Integer) For i=1 To 4 b(i)=2*i Next i End Sub Private Sub Form_Click() Dim a(4)As Integer For i=1 To 4 a(i)=i+4 Next i P a For i=1 To 4 Print a(i) Next i End Sub 运行上面的程序,单击窗体,输出结果为 A: 2 4 6 8 B: 5 6 7 8 C: 10 12 14 16 D: 4 8 12 16
- 以下程序的输出结果是___________。for i in range(1,11): print(i, end = " ") A: 1 2 3 4 5 6 7 8 9 B: 1 2 3 4 5 6 7 8 9 10 C: 1 2 3 4 5 D: 1 3 5 7 9