Write a program that takes an integer as the number of minutes and outputs the total hours and minutes (90 minutes = 1 hour 30 minutes).
Answers
Answered by
0
Answer:
#include <stdio.h>
int tot_mins; /* given number of minutes */
int hrs; /* number of hours (to be computed) */
int mins; /* number of minutes (to be computed) */
const int MINaHOUR = 60; /* number of minutes in an hour */
char line_text[50]; /* line of input from keyboard */
int main() {
printf("Input minutes: ");
fgets(line_text, sizeof(line_text), stdin);
sscanf(line_text, "%d", &tot_mins);
hrs = (tot_mins / MINaHOUR);
mins = (tot_mins % MINaHOUR);
printf("%d Hours, %d Minutes.\n", hrs, mins);
return(0);
}
Answered by
0
Answer:
total hours 24 and minutes 720
Similar questions
Math,
2 days ago
Math,
4 days ago
Biology,
4 days ago
Math,
8 months ago
Social Sciences,
8 months ago