Speeding judgment

Speeding judgment

Simulation of traffic police radar guns. Enter the vehicle speed, if the speed exceeds 60 mph, the display "Speeding", otherwise display "OK".

Input format:
Input not exceeding 500 gives a non-negative integer in a row, i.e., the vehicle speed radar.

Output format:
in one line the output result speedometer display format: Speed: V - S, where V is the vehicle speed, S or Speeding, or OK.

Input Example 1:
40

Sample output 1:
Speed: 40 - the OK

Input Sample 2:
75

Output Sample 2:
Speed: 75 - Speeding
c language

#include<stdio.h>
int main()
{
    int speed;
    scanf("%d",&speed);
    if(speed>60)
    printf("Speed: %d - Speeding",speed);
    else
    printf("Speed: %d - OK",speed);
    return 0;
}
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
         int speed;
        Scanner reader=new Scanner(System.in);
        speed=reader.nextInt();
        if(speed>60)
        	System.out.printf("Speed: %d - Speeding",speed);
        else
        	System.out.printf("Speed: %d - OK",speed);
    }
}
Released seven original articles · won praise 1 · views 116

Guess you like

Origin blog.csdn.net/weixin_45714844/article/details/104093863