/* To convert
time given in seconds into hours, minutes and seconds */
#include<stdio.h>
#include<conio.h>
void
main()
{
int hr,min,sec,t;
clrscr();
printf("Enter time in seconds: ");
scanf("%d",&t);
/* Compute Hours */
hr=t/3600;
/*
Compute Minutes */
min=(t%3600)/60;
/*
Compute Seconds */
sec=(t%3600)%60;
printf("\n Calculated Time: ");
printf("\n\n Time is %dhours, %dminutes,
%dseconds",hr,min,sec);
getch();
}
OUTPUT
Enter
time in seconds: 5432
Calculated Time:
Time
is 1hours, 30minutes, 32seconds
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.