Drop hier links of afbeeldingen om ze aan de editor toe te voegen.

Convert seconds to hours and minutes.

★★☆

The number of seconds can also be expressed in hours and minutes.

Seconds in a day

Make

Write a program that allows the user to enter the number of seconds. The program outputs the number of equivalent hours, minutes and seconds that is.

Success Criteria

Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.

Complete the subprogram called seconds_to_hours that:

  1. Returns the number of hours calculated as seconds integer divided by three thousand six hundred.

Complete the subprogram called seconds_to_minutes that:

  1. Returns the number of minutes calculated as seconds integer divided by sixty, modulo sixty.

Complete the subprogram called seconds_remaining that:

  1. Returns the modulo of seconds by sixty.

Complete the main program so that:

  1. The user can input the number of seconds.
  2. It outputs the number of seconds in hours, minutes and seconds.

Typical inputs and outputs from the program would be:

Enter the number of seconds:
60
0 hours 1 minutes 0 seconds
Enter the number of seconds:
86000
23 hours 53 minutes 20 seconds
🆘 If you're really stuck, use this Parsons code sorting exercise
Complete program
// Seconds in a day program

using System;

class Submission
{
---
    // -------------------------
    // Subprograms
    // -------------------------
    // Function to return the number of hours from seconds
---
    static int seconds_to_hours(int seconds)
    {
---
        return seconds / 3600;
---
    }
---


    // Function to return the number of minutes from seconds
    static int seconds_to_minutes(int seconds)
    {
---
        return (seconds / 60) % 60;
---
    }
---


    // Function to reduce the number of seconds after minutes calculated
    static int seconds_remaining(int seconds)
    {
---
        return seconds % 60;
---
    }
---


    // -------------------------
    // Main program
    // -------------------------
    public static void Main(string[] args)
    {
---
        Console.WriteLine("Enter the number of seconds:");
        int seconds = Convert.ToInt32(Console.ReadLine());
        int hours = seconds_to_hours(seconds);
        int minutes = seconds_to_minutes(seconds);
        seconds = seconds_remaining(seconds);
---
        Console.WriteLine($"{hours} hours {minutes} minutes {seconds} seconds");
---
    }
---
}