题解 | 学生基本信息输入输出

学生基本信息输入输出

https://www.nowcoder.com/practice/58b6a69b4bf943b49d2cd3c15770b9fd

#include <stdio.h>
#include <math.h>
int main()
{
    int id = 0;            //学号
    float c = 0;           //c语言成绩
    float math = 0;        //数学成绩
    float english = 0;     //英语成绩
    scanf("%d;%f,%f,%f", &id, &c, &math, &english);//输入学号和三科成绩
    c = round(c*100)/100;  //用round函数进行四舍五入的操作
    math = round(math*100)/100;
    english = round(english*100)/100;
    printf("The each subject score of No. %d is %.2f, %.2f, %.2f.", id, c, math, english);

    return 0;
}

全部评论

相关推荐

04-17 10:16
门头沟学院 Java
不河狸啊:为什么我的是已送达,连已读都没有
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务