Write a program that reads three integers representing hours, minutes, and seconds of a time from keyboard. Then it calculates the equivalent time in seconds and print the total seconds.
Answers
Answered by
4
Answer:
int main() {
int sec, h, m, s;
printf("Input seconds: ");
scanf("%d", &sec);
h = (sec/3600);
m = (sec -(3600*h))/60;
s = (sec -(3600*h)-(m*60));
printf("H:M:S - %d:%d:%d\n",h,m,s);
return 0;
}
Explanation:
Answered by
2
answer:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,tos;
printf("enter the hour ,minutes and seconds respectively\n");
scanf("%d\n%d\n%d",&a,&b,&c);
tos=(((a*60)+b)*60)+c;
printf("total seconds are : %d",tos);
getch();
}
Similar questions