zoukankan      html  css  js  c++  java
  • 实验六

    #include <stdio.h>
    #include <math.h>
    float average3(float a,float b,float c)
    {
    float x;
    x=(a+b+c)/3;
    return x;
    }
    float average5(float a,float b,float c,float d,float e)
    {
    float x;
    x=(a+b+c+d+e)/5;
    return x;
    }
    int main()
    {
    float student1,student2,student3,student4,student5;
    float subject1,subject2,subject3;
    int i,j;
    float a[5][3];
    for(i=0;i<5;i++)
    {
    for(j=0;j<3;j++){
    scanf("%f",&a[i][j]);
    }
    }
    student1=average3(a[0][0],a[0][1],a[0][2]);
    student2=average3(a[1][0],a[1][1],a[1][2]);
    student3=average3(a[2][0],a[2][1],a[2][2]);
    student4=average3(a[3][0],a[3][1],a[3][2]);
    student5=average3(a[4][0],a[4][1],a[4][2]);
    printf("同学1的总平均分为:%f 同学2的总平均分为:%f 同学3的总平均分为:%f 同学4的总平均分为:%f 同学5的总平均分为:%f ",student1,student2,student3,student4,student5);

    subject1=average5(a[0][0],a[1][0],a[2][0],a[3][0],a[4][0]);
    subject2=average5(a[0][0],a[1][1],a[2][1],a[3][1],a[4][1]);
    subject3=average5(a[0][0],a[1][1],a[2][2],a[3][2],a[4][2]);
    printf("科目1的总平均分为%f 科目2的总平均分为%f 科目3的总平均分为%f ",subject1,subject2,subject3);

    return 0;


    }

  • 相关阅读:
    「HDU3640」I,Zombie
    气温变化折线图/matplotlib中文显示
    基本折线图
    根据统计数据画直方图
    matplotlib直方图绘制(hist)
    豆瓣Top250电影数据爬取学习
    pd.set_option参数设置
    django安装
    字典公共键
    字典排序
  • 原文地址:https://www.cnblogs.com/P201821430045/p/11059665.html
Copyright © 2011-2022 走看看