Skip to content

Instantly share code, notes, and snippets.

@DanielRapp
Created March 13, 2011 17:42
Show Gist options
  • Save DanielRapp/868283 to your computer and use it in GitHub Desktop.
Save DanielRapp/868283 to your computer and use it in GitHub Desktop.
homework v11
using System;
class MainClass
{
static TimeSpan getTimeSec() {
Console.Write("Timme: ");
int hour = Int32.Parse(Console.ReadLine());
Console.Write("Minut: ");
int min = Int32.Parse(Console.ReadLine());
Console.Write("Sekund: ");
int sec = Int32.Parse(Console.ReadLine());
return new TimeSpan(hour, min, sec);
}
public static void Main (string[] args)
{
Console.WriteLine("Starttid:");
TimeSpan startTime = getTimeSec();
Console.WriteLine("Målgångstid:");
TimeSpan endTime = getTimeSec();
TimeSpan timeDiff = endTime.Subtract(startTime);
Console.WriteLine("Resultat: {0} tim {1} min {2} sek",
timeDiff.Hours,
timeDiff.Minutes,
timeDiff.Seconds);
Console.ReadKey();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment