Write a program to accept number of seconds and display its corresponding hours, minutes and seconds.
Answers
Answered by
0
Answer:
Is it BlueJ programming?
Answered by
0
A program to accept number of seconds and display its corresponding hours, minutes and seconds:
#include<conio.h>
void main()
{
int sec,hr,min;
clrscr();
printf("enter sec:-");
scanf("%d",&sec);
hr=sec/3600;
sec=sec%3600;
min=sec/60;
sec=sec%60;
printf("%d hr %d min %d sec ",hr,min,sec);
getch();
}
This is a simple program where the seconds are obtained. The seconds’ value is divided by 3600 to get the value of hour and then its remainder is obtained to store in the variable of seconds and then it is divided by 60 to get the minutes.
Similar questions
English,
6 months ago
Hindi,
6 months ago
Physics,
1 year ago
India Languages,
1 year ago
Biology,
1 year ago
Social Sciences,
1 year ago