Our friend Mark drove to Chicago from Detroit last month It

. Our friend, Mark, drove to Chicago from Detroit last month. It took 4 hours and 38 minutes to drive the 238 mile distance between two cities. Write a function that Asked for distance and time that it takes to go there and then calculate how long it takes (in minute) to drive one mile.

Solution

#include <stdio.h>

void calculate() //function to calculate time it take to travel per mile
{
   float distance,time,speed;
   printf(\"\ Enter the distance\");
   scanf(\"%f\",&distance);
   printf(\"\ Enter time\");
   scanf(\"%f\",&time);
  
   time = time/distance; //time calculated per mile
   printf(\"\ It takes %.2f minute to drive one mile\",time);
  
  
}
int main(void)
{
   calculate(); //call to function
   return 0;
}

output:

Success time: 0 memory: 2172 signal:0

. Our friend, Mark, drove to Chicago from Detroit last month. It took 4 hours and 38 minutes to drive the 238 mile distance between two cities. Write a function

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site