This program asks the user to enter the times in term of seconds. Then it convert time in seconds to hours, Minutes and seconds.
#include<stdio.h>
#include<conio.h>
Void main()
{
long sec, hr, min, t; // Declaration of variables
printf(“\n Enter time in seconds: “);
scanf(“%ld”, &sec); // we have used ld for long integer
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();
}
Latest posts by Mohit Arora (see all)
- MongoDB Operators Tutorial – What are Different Operators Available? - October 5, 2019
- MongoDB Projection Tutorial : Return Specific Fields From Query - March 9, 2019
- MongoDB Index Tutorial – Create Index & MongoDB Index Types - July 6, 2018