• 2021-04-14
    <7>/*------------------------------------------------------
    【程序改错】请在FOUND注释行下一行找出错误,并将正确写法填写到对应空格内
    --------------------------------------------------------
    功能:编写程序, 求矩阵(3行3列)与5的乘积例如:输入下面的矩阵:
    100 200 300
    400 500 600
    700 800 900
    程序输出:
    500 1000 1500
    2000 2500 3000
    3500 4000 4500
    ------------------------------------------------------*/

    #include

    void fun(int array[3][3])
    {
    /**********FOUND**********/
    int i;j;
    /**********FOUND**********/
    for(i=1; i < 3; i++)
    for(j=0; j < 3; j++)
    /**********FOUND**********/
    array[i][j]=array[i][j]/5;
    }


    main()
    {
    int i,j;
    int array[3][3]={{100,200,300},
    {400,500,600},
    {700,800,900}};
    for (i=0; i < 3; i++)
    {
    for (j=0; j < 3; j++)
    printf("%7d",array[i][j]);
    printf("
    ");
    }
    fun(array);
    printf("Converted array:
    ");
    for (i=0; i < 3; i++)
    {
    for (j=0; j < 3; j++)
    printf("%7d",array[i][j]);
    printf("
    ");


    }
    }
  • 举一反三