Computer Science, asked by Shanvi22, 1 year ago

Write a program in C++ to input hours , minutes and seconds. Calculate and print the total time in seconds.

Help me fast and I will follow u


Anonymous: I m In class now , in 2 hrs I will help u , sorry
Shanvi22: but tomorrow is my exam

Answers

Answered by aniket00715
0

#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);

}

HOPE THIS ANSWER WILL HELP YOU

Attachments:

aniket00715: got my no.
Shanvi22: insta
Shanvi22: plssssss
aniket00715: okk
Shanvi22: you should
aniket00715: but not now
aniket00715: suno
aniket00715: whatsapp pe baat karo
aniket00715: no. mere profile mein hai
aniket00715: Hy
Similar questions