• 2022-06-03 问题

    以下程序的输出结果是____。 #include<stdio.h> int main() { int a&#91;3&#93;&#91;3&#93;={1,2,3,4,5,6,7,8,9},sum=0,i,j; for (i=0;i<3;i++) sum=sum+a[i][i]; printf("sum=%d\n",sum); return 0; }[/i][/i]

    以下程序的输出结果是____。 #include<stdio.h> int main() { int a&#91;3&#93;&#91;3&#93;={1,2,3,4,5,6,7,8,9},sum=0,i,j; for (i=0;i<3;i++) sum=sum+a[i][i]; printf("sum=%d\n",sum); return 0; }[/i][/i]

  • 2021-04-14 问题

    中国大学MOOC:4、输出如下程序的结果:#includeintmain(){inta[3][3]={{98,97,99},{100,67,89},{78,89,79}};inti,j=0;floatsum=0;for(i=0;i<5;i++)sum=sum+a[j][i];printf(%f,sum/5);return0;}

    中国大学MOOC:4、输出如下程序的结果:#includeintmain(){inta[3][3]={{98,97,99},{100,67,89},{78,89,79}};inti,j=0;floatsum=0;for(i=0;i<5;i++)sum=sum+a[j][i];printf(%f,sum/5);return0;}

  • 2021-04-14 问题

    def func(): global sum sum=0 print(sum) for i in range(5): sum+=1 print(sum) func() print(sum)

    def func(): global sum sum=0 print(sum) for i in range(5): sum+=1 print(sum) func() print(sum)

  • 2022-06-19 问题

    阅读下面代码,判断正误sum = 0i = 1while i<;10: sum = sum + i i = i +1print "sum is ", sum

    阅读下面代码,判断正误sum = 0i = 1while i<;10: sum = sum + i i = i +1print "sum is ", sum

  • 2021-04-14 问题

    下面程序的功能:输入一个3*3的整数矩阵,输出正对角线上元素之和。#include int main (){ int a[3][3],i,j,sum=0; for(i=0;i<3;i++) //输入一个3*3的整数矩阵 for(j=0;j<3;j++) scanf(%d,&a[i][j]); for(i=0;i<=3;i++) //计算对角线上元素之和 for(j=0;j<3;j++) if(j=i) sum=sum+a[i][j]; printf(%d,sum); return 0;}请判断:在“计算对角线上元素之和”这段程序中,共有2处错误,对吗?

    下面程序的功能:输入一个3*3的整数矩阵,输出正对角线上元素之和。#include int main (){ int a[3][3],i,j,sum=0; for(i=0;i<3;i++) //输入一个3*3的整数矩阵 for(j=0;j<3;j++) scanf(%d,&a[i][j]); for(i=0;i<=3;i++) //计算对角线上元素之和 for(j=0;j<3;j++) if(j=i) sum=sum+a[i][j]; printf(%d,sum); return 0;}请判断:在“计算对角线上元素之和”这段程序中,共有2处错误,对吗?

  • 2022-06-15 问题

    将下面的for循环转换为while循环,补全代码。 long sum=0; for(inti=0;i<=100;i++) sum=sum+i; System.out.println("sum="+sum); 改写成: long sum=0; ① ; while( ② ){ sum=sum+i; ③ ; } System.out.println("sum="+sum);

    将下面的for循环转换为while循环,补全代码。 long sum=0; for(inti=0;i<=100;i++) sum=sum+i; System.out.println("sum="+sum); 改写成: long sum=0; ① ; while( ② ){ sum=sum+i; ③ ; } System.out.println("sum="+sum);

  • 2021-04-14 问题

    System.out.println("sum:"+sum);为输出sum的值。

    System.out.println("sum:"+sum);为输出sum的值。

  • 2022-07-28 问题

    在下列程序段中,不能计算1到100之间奇数之和的是__________。 A: Dim sum As Integer sum = 0 For i = 1 To 100 Step 2 sum = sum + i Next B: Dim sum As Integer sum = 0 For i = 1 To 100 If i Mod 2 &lt;&gt; 0 Then sum = sum + i Next C: Dim sum As Integer sum = 0 For i = 1 To 99 sum = sum + i Next D: Dim sum As Integer sum = 0 For i = 100 To 1 Step -1 If i Mod 2 &lt;&gt; 0 Then sum = sum + i Next

    在下列程序段中,不能计算1到100之间奇数之和的是__________。 A: Dim sum As Integer sum = 0 For i = 1 To 100 Step 2 sum = sum + i Next B: Dim sum As Integer sum = 0 For i = 1 To 100 If i Mod 2 &lt;&gt; 0 Then sum = sum + i Next C: Dim sum As Integer sum = 0 For i = 1 To 99 sum = sum + i Next D: Dim sum As Integer sum = 0 For i = 100 To 1 Step -1 If i Mod 2 &lt;&gt; 0 Then sum = sum + i Next

  • 2022-06-15 问题

    如果N=2,Sum(N)是一个函数,且Sum(1)=5,那么语句:Set Sum=Sum(N-1) +N将把值6赋给Sum。If N = 2, Sum (N) is a function and Sum (1) = 5, then the statement:Set Sum = Sum (N-1) +NThe value 6 will be assigned to Sum.

    如果N=2,Sum(N)是一个函数,且Sum(1)=5,那么语句:Set Sum=Sum(N-1) +N将把值6赋给Sum。If N = 2, Sum (N) is a function and Sum (1) = 5, then the statement:Set Sum = Sum (N-1) +NThe value 6 will be assigned to Sum.

  • 2022-06-19 问题

    下面的代码段有什么错误?for(i = 0; i <; 10; i++) {int sum;sum = sum + i;}System.out.println("Sum is: " + sum);

    下面的代码段有什么错误?for(i = 0; i <; 10; i++) {int sum;sum = sum + i;}System.out.println("Sum is: " + sum);

  • 1 2 3 4 5 6 7 8 9 10