#include <stdio.h> int main() { long num; float c,m,e; scanf("%d;%f,%f,%f",&num,&c,&m,&e); printf("The each subject score of No. %d is %.2f, %.2f, %.2f.",num,c,m,e); return 0; }
由于成绩后面的小数需要四舍五入,所以使用float来定义成绩的类型。
#include <stdio.h> int main() { long num; float c,m,e; scanf("%d;%f,%f,%f",&num,&c,&m,&e); printf("The each subject score of No. %d is %.2f, %.2f, %.2f.",num,c,m,e); return 0; }
由于成绩后面的小数需要四舍五入,所以使用float来定义成绩的类型。