- 5

Write a C program to convert a given integer (in seconds) to hours, minutes and seconds

11th Oct 2020, 10:44 AM
Sachithra Bandara
Sachithra Bandara - avatar
1 Odpowiedź
- 3
#include <stdio.h> int main() { int sec, h, m, s; printf("Input seconds: "); scanf("%d", &sec); h = (sec/3600); m = (sec -(3600*h))/60; s = (sec -(3600*h)-(m*60)); printf("H:M:S - %d:%d:%d\n",h,m,s); return 0; }
11th Oct 2020, 10:44 AM
Sachithra Bandara
Sachithra Bandara - avatar