C语言:用scanf和%.2f实现要求
#include <stdio.h>
int main( ){
int num;
float a,b,c;
scanf("%d;%f,%f,%f",&num,&a,&b,&c); //scanf可以指定输入分割
//用%.2f进行四舍五入保留两位小数
printf("The each subject score of No. %d is %.2f, %.2f, %.2f.",num,a,b,c);
return 0;
}

京公网安备 11010502036488号