Question: Given an integer number of seconds, compute how many hours, minutes (within an hour) and seconds (within a minute) this corresponds to. Again, your program
Given an integer number of seconds, compute how many hours, minutes (within an hour) and seconds (within a minute) this corresponds to. Again, your program should prompt the user for one number of seconds each time it is run. You should fix any bugs so that it compiles and runs. Try some hand examples for this task and make sure your program always produces the correct answer (for example, what should the output be for 3775 seconds?). /*
* This program reads a number of seconds and computes how many
* hours, minutes and seconds that corresponds to.
*/
main()
{ int seconds; int hours, minutes
/* get the number of seconds */
printf("Enter the number of seconds: "); scanf("%d", seconds); /* compute the number of hours */
hours = seconds / 3600;
/* compute the number of minutes */
minutes = seconds / 60;
/* compute the number of seconds remaining */
seconds = secondss % 60;
/* print the result */
printf("there are %d hours, %d minutes, %d seconds ", hours, minutes);
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
