develop a function for checking the speed of drivers. This function
should have one parameter: speed.
1. If speed is less than 70, it should print “Ok”.
2. Otherwise, for every 5km above the speed limit (70), it should
give the driver one demerit point and print the total number of
demerit points. For example, if the speed is 80, it should print:
“Points: 2”.
3. If the driver gets more than 12 points, the function should print:
“License suspended”
Answers
Answered by
0
Answer:
Here we need to create a function in C to check the speed of the drivers with one parameter speed which means speed will be passed to us from another function.
We also need to ensure that the function prints ok for speed less than 70, prints the demerit point for every 5km above speed limit and if demerit points over 12 then license suspended.
void speedcheck( int speed )
{
if(speed < 70 )
printf("Ok");
else
{
int i;
int c = 0;
for( i = 70; i < = speed ; i = i + 5)
c++;
if(c < 12)
printf(" Points : %d", c );
else
printf(" “License suspended ”);
}
}
Similar Problems
https://brainly.in/question/9599693
https://brainly.in/question/6495944
#SPJ1
Similar questions