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;
    }

  • 相关阅读:
    step_by_step_ABP规约模式
    阅读书单
    关于我
    友情链接
    数据夜话之大数据OLAP数据库概览
    Spark实战
    StormDRPC流程解读
    Curator源码阅读
    Storm使用总结
    JNI相关使用记录
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/14727514.html
Copyright © 2011-2022 走看看