Home   Cover Cover Cover Cover
 

Umwandlung von Sekunden in Uhrzeiten

A01.cs
//===========================================================
// Convert seconds into a time tuple
//===========================================================

using System;

public class A1 {
  
  static (int h, int m, int s) ToClockTime(int sec) {
    int h = sec / 3600;
    int m = sec % 3600 / 60;
    int s = sec % 60;
    return (h, m, s);
  }

  public static void Main() {
    (int h, int m, int s) = ToClockTime(10000);
    Console.WriteLine(h + ":" + m + ":" + s);
    
    (h, m, s) = ToClockTime(100000);
    Console.WriteLine(h + ":" + m + ":" + s);
  }
}