Write a program that prompts the user for a number of seconds-assume that the us
ID: 1936245 • Letter: W
Question
Write a program that prompts the user for a number of seconds-assume that the user enters a non-negative integer value. Calculate and output the equivalent number of hours, minutes and seconds. A sample session should look something like this, with appropriate values calculated and output. Assignment 1, part b) for your name Please enter the number of seconds: 5678 5678 seconds is hours, minutes and seconds. Required Documentation and Style for All Programs. See Assignment la Other requirements: In this program, all values are int.Explanation / Answer
#include int main() { int input,hour,min,sec; int temp; printf("enter the number of seconds"); scanf("%d",&input); temp=input/3600; hour=temp; input=input-hour*3600; min=input/60; sec=input-min*60; printf("%d hours,%d minutes,%d seconds",hour,min,sec); }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.