浙大版《C语言程序设计(第3版)》题目集 习题3-2 高速公路超速处罚 (15分)

在这里插入图片描述

#include <stdio.h>
int main()
{
	float speed, max, x;
	scanf("%f %f", &speed, &max);
	x = (speed - max) / max * 100; //时速与限速的差值。
	if (x >= 50)
		printf("Exceed %.0f%%. License Revoked\n", x);
	else if (x >= 10)
		printf("Exceed %.0f%%. Ticket 200\n", x);
	else
		printf("OK\n");
	return 0;
}
发布了161 篇原创文章 · 获赞 117 · 访问量 6014

猜你喜欢

转载自blog.csdn.net/qq_44458489/article/details/105282095