C语言 如何实现 输出一个总成绩?

#这是一个求平均数的C语言代码,但是只会输出平均成绩,请问一下我该如何 在输出平均成绩的同时也输出总成绩?谢谢

#include<stdio.h>
int main()
{
    int num;
    double score, total;
    num = 0;
    total = 0;
    printf("请输入学生的成绩:\n\n");
    scanf_s("%lf", &score);
    while (score >= 0)
    {
        total = total + score;
        num++;
        scanf_s("%lf", &score);
    }
    if (num != 0)
        printf("Score average is %.2f\n", total / num);
    else
        printf("Score average is 0\n");
    return 0;

}


#include<stdio.h>
int main()
{
    int num;
    double score, total;
    num = 0;
    total = 0;
    printf("请输入学生的成绩:\n\n");
    scanf_s("%lf", &score);
    
    while (score >= 0)
    {
        total = total + score;
        num++;
        scanf_s("%lf", &score);
    }
    if (num != 0)
        printf("Score average is %.2f\n", total / num);
        printf("总成绩 %.2f\n", total);

    return 0;
}

加上这行代码就可以了

img