Write a program that converts a given time in seconds minute

Write a program that converts a given time in seconds, minutes, and hours to all seconds. Enter the time in seconds, minutes, and hours: 34 17 5 There are 19054 seconds in 5 hours, 17 minutes, and 34 seconds

Solution

#include <stdio.h>

#include <conio.h>

main()

{

long h,m,s,ans;

printf(\" Enter time in seconds,minutes and hours:\");

scanf(\"%ld %ld %ld\",&s,&m,&h);

ans=s+60*m+3600*h;

printf(\"There are %ld sec in %ld hours,%ld minutes and %ld seconds\",ans,h,m,s);

getch();

}

 Write a program that converts a given time in seconds, minutes, and hours to all seconds. Enter the time in seconds, minutes, and hours: 34 17 5 There are 1905

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site