zoukankan      html  css  js  c++  java
  • c语言 512

    1、

    #include <stdio.h>
    
    int main(void)
    {
        int i, j, k, a[2][4][3], b[4][3] = {0};
        puts("please input the elements of the array.");
        for(i = 0; i < 2; i++)
        {
            for(j = 0; j < 4; j++)
            {
                for(k = 0; k < 3; k++)
                {
                    printf("a[%d][%d][%d] = ", i, j, k); scanf("%d", &a[i][j][k]);
                }
            }
        }
        
        puts("\nshow the matrix form of the two examinations.");
        for(i = 0; i < 2; i++)
        {
            for(j = 0; j < 4; j++)
            {
                for(k = 0; k < 3; k++)
                {
                    printf("%4d", a[i][j][k]);
                }
                putchar('\n');
            }
            puts("\n==============================================\n");
        }
        
        puts("\ncalculate the sum of two examinations.");
        for(i = 0; i < 4; i++)
        {
            for(j = 0; j < 3; j++)
            {
                for(k = 0; k < 2; k++)
                {
                    b[i][j] += a[k][i][j];
                }
            }
        }
        for(i = 0; i < 4; i++)
        {
            for(j = 0; j < 3; j++)
            {
                printf("%4d", b[i][j]);
            }
            putchar('\n');
        }
        return 0;
    }

  • 相关阅读:
    es6
    vue-router
    vue-lazyload
    java-number2
    echart事件
    weui了解
    java-number
    Java判断语句
    java 循环控制
    The access type for the readers of the blog.
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/14727514.html
Copyright © 2011-2022 走看看