PTA basic programming topics 7-8
topic
7-8 overspeed determination (10 minutes)
simulation of the traffic police radar gun. Enter the vehicle speed, if the speed exceeds 60 mph, the display "Speeding", otherwise display "OK".
Input formats:
Input gives a less than 500 non-negative integer in a row, i.e., the radar sensed vehicle speed.
Output formats:
In line output speedometer display the results in the format: Speed: V - S, where V is the vehicle speed, S or Speeding, or OK.
Sample Input 1:
40
Output Sample 1:
Speed: 40 - OK
Sample Input 2:
75
Output Sample 2:
Speed: 75 - Speeding
Resolve
The main question investigated if-else,
pay attention to the point: The output formats are separated by spaces note with the title consistent formatting can be.
Answers
#include <stdio.h>
int main()
{
int V,Speed;
scanf("%d",&V);
if(V>60){
printf("Speed: %d - Speeding",V);
}
else{
printf("Speed: %d - OK");
}
return 0;
}
Tree holes today
The second blog post, the heart no waves. Excitement has cooled.
Maybe I should try title back to do it. In front of the title and the back of the title with a come.
Parsing maybe can long point.
MOOk Zhejiang Weng Kai teacher has not yet commenced. In station B brush video.
Come on!
2020.1.29