Exercise 3-2 motorway speeding penalties (15point (s)). C

According to regulations, the exercise of a motor vehicle on the highway, lane speed limit is reached or exceeded 10% of the fine of 200 yuan; If you reach or exceed 50%, will be revoked driver's license. Please write processing of the program is automatically determined based on the vehicle speed and the vehicle speed.

Input format:
input given in row two positive integers, respectively, corresponding to the vehicle speed and the speed limit, separated by a space therebetween.

Output formats:
Output in line Disposition: It's normal driving, the output "OK"; if should be fine, the output "Exceed x% Ticket 200." ; If should be revoked driver's license, the output "Exceed x%. License Revoked ". Where x is the percentage of speed to the nearest integer.

Input Sample 1:
6560

Output Sample 1:
the OK

Input Sample 2:
110100

Output Sample 2:
. 10% Ticket 200 is Exceed

Input Sample 3:
200120

Output Sample 3:
. Exceed 67% License Revoked

Knowledge point: how to output percentage sign
?? Please click the link: Add a link description

//   Date:2020/3/17
//   Author:xiezhg5
#include <stdio.h>
int main(void)
{
	int a,b;
	double c;
	scanf("%d %d",&a,&b);
    c=(double)(a-b)/b;
    if(c<0.1)
    	printf("OK\n");
    if(c>=0.1&&c<0.5)
    	printf("Exceed %.0lf%%. Ticket 200\n",100.0*c);  //注意怎么输出百分号 
    if(c>=0.5)
    	printf("Exceed %.0lf%%. License Revoked\n",100.0*c);
	return 0;
}
Published 65 original articles · won praise 28 · views 1745

Guess you like

Origin blog.csdn.net/qq_45645641/article/details/104929581