Comments | Online Safety | Help
     
  #include<stdio.h>
#include <stdlib.h>
#include<conio.h>
#include<ctype.h>

int main (void)
{
    int distance = 0,
    speed = 0,
    hours = 0,
    minutes = 0;

    do
    {   printf("\n\nEnter the distance to travel in miles > ");
        scanf("%d", &distance);
        printf("Enter the speed to travel at (mph) > ");
        scanf("%d", &speed);

        hours = distance / speed;
        minutes = ((distance % speed) / (float)speed) * 60.0;

        printf("It would take %d hours:%d minutes\n",hours, minutes);
        printf("to travel %d miles at %d mph\n", distance, speed);
        printf("Do you wish to perform another calculation (Y/N) >");

    }while( (toupper(getch())) == 'Y');
    return EXIT_SUCCESS;
}