Write a function that takes time in seconds as input and prints it in terms of hours, minutes and seconds.
#include<stdio.h>
#include<conio.h>
void main( )
{
int sec, hr = 0, min = 0;
clrscr( );
printf("\n Enter the time in seconds..:"); scanf("%d",&sec);
min = sec / 60;
sec = sec % 60;
hr = min / 60;
min = min % 60;
printf("\n The time is %d hr: %d min: %d sec",hr,min,sec);
getch();
}
Click here to contact us
#include<stdio.h>
#include<conio.h>
void main( )
{
int sec, hr = 0, min = 0;
clrscr( );
printf("\n Enter the time in seconds..:"); scanf("%d",&sec);
min = sec / 60;
sec = sec % 60;
hr = min / 60;
min = min % 60;
printf("\n The time is %d hr: %d min: %d sec",hr,min,sec);
getch();
}
Click here to contact us
No comments:
Post a Comment