Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following program converts seconds to minutes and seconds. It uses integer d

ID: 3886116 • Letter: T

Question

The following program converts seconds to minutes and seconds. It uses integer division and the modulus operator to convert seconds to minutes and seconds. /* Convert seconds to minutes and seconds */ include int main(void) { int input_value, minutes, seconds: printf("Input the number of seconds: "): scanf("%d%, &input;_value): } Complete the program. For example, if 123 is entered after the prompt, the program prints 123 seconds is equivalent to 2 minutes and 3 seconds Modify your program in 3 so that seconds are converted to hours, minutes, and seconds. If 7384 is entered after the prompt, the program prints 7384 seconds is equivalent to 2 hours, 3 minutes and 4 seconds

Explanation / Answer

#include <stdio.h>

int main()
{
int input_value, minutes , seconds, hours;
printf("Input the number of seconds: ");
scanf("%d", &input_value);
hours = input_value / 3600;
seconds = input_value % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
printf("%d seconds is equivalent to %d hours, %d minutes and %d seconds ", input_value, hours, minutes, seconds);
return 0;
}

Output: