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

学生基本信息输入输出

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

# include<stdio.h>
# include<math.h>

float T(float t);
int main(void)
{
    int x;
    float a,b,c;
    x = 0;
    a = 0.0;
    b = 0.0;
    c = 0.0;
    
    scanf("%d;%f,%f,%f",&x,&a,&b,&c);
    printf("The each subject score of No. %d is %.2f, %.2f, %.2f.",x,T(a),T(b),T(c));
    return 0;
}
float T(float t)
{
	if((t*100-floor(t*100)) >= 0.5)
		t = (floor(t*100)+1)/100;
	if((t*100-floor(t*100)) < 0.5)
		t = (floor(t*100))/100;
	return t;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务