CProgram

Convert Time in Seconds to Hours, Minutes and Seconds

Write a Program to Convert Time in Seconds to Hours, Minutes, and Seconds.

/*Program to Convert Time in Seconds to Hours, Minutes and Seconds*/
#include <stdio.h>
main()
{
long sec, hr, min, t;
printf(“\nEnter time in seconds: “);
scanf(“%ld”, &sec);
hr = sec/3600;
t = sec%3600;
min = t/60;
sec = t%60;
printf(“\n\nTime is %ld hrs %ld mins %ld secs”, hr, min, sec);
getch();
}

What's your reaction?

Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0

You may also like

Leave a reply

Your email address will not be published.

More in:C