17. Write a C program to convert a given integer (in seconds) to hours, minutes and seconds
17. Write a C program to convert a given integer (in seconds) to hours, minutes and seconds.
Test Data :
Input seconds: 25300
Expected Output:
There are:
H:M:S - 7:1:40
Test Data :
Input seconds: 25300
Expected Output:
There are:
H:M:S - 7:1:40
*/
#include <stdio.h>
int main() {
int sec, hour, min, s;
printf("Input seconds: ");
scanf("%d", &sec);
hour= (sec/3600);
min= (sec -(3600*hour))/60;
s = (sec -(3600*hour)-(min*60));
printf("H:M:S - %d:%d:%d\n",hour,min,s);
return 0;
}
Comments
Post a Comment
PLEASE DO NOT ENTER THE SPAM LINK IN THE COMMENT BOX