Write a program that, given as input
  • the distance (in feet) between two "checkpoints",
  • the time (in seconds) taken by an automobile to travel from the first checkpoint to the second, and
  • the speed limit (in miles per hour)
determines whether or not the average speed of the automobile in traveling from one checkpoint to the other exceeded the speed limit.
Reminder: There are 5280 feet in a mile and 3600 seconds in an hour.
 

Input Format:
Input consists of 3 real numbers. The first real number corresponds to the distance, the second corresponds to time and the third corresponds to speed limit.
Output Format:
Refer sample output for details.
Sample Input 1:
50.0
0.6
55.0
Sample Output 1:
Speeding

Sample Input 2:

2.5
0.035
55.0
Sample Output 2:
Not Speeding

Program Code:
#include<stdio.h>
int main()
{
    float s,t,d, sl;
    scanf("%f", &d);
     scanf("%f", &t); 
     scanf("%f", &sl);
     d = d/5280;
     t = t/3600;
     s=d/t;
     if(s>sl)
     printf("Speeding");
     else
     printf("Not Speeding");
     return 0;     
}

Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: