Advertisement
Guest User

Untitled

a guest
Dec 5th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. using System;
  2. using System.Globalization;
  3.  
  4. class ExamTime
  5. {
  6. static void Main()
  7. {
  8. string hour = Console.ReadLine();
  9. string minutes = Console.ReadLine();
  10. string partOfDay = Console.ReadLine().ToLower();
  11. int examHours = int.Parse(Console.ReadLine());
  12. int examMinutes = int.Parse(Console.ReadLine());
  13. string time = hour + ":" + minutes + ":" + partOfDay;
  14. DateTime startTime = DateTime.ParseExact(time, "h:mm:tt", CultureInfo.InvariantCulture);
  15. DateTime endTime = startTime.AddHours(examHours).AddMinutes(examMinutes);
  16. Console.WriteLine(endTime.ToString("hh:mm:tt"));
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement