Advertisement
Aliendreamer

timespan example

May 30th, 2018
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.32 KB | None | 0 0
  1. using System;
  2.  
  3.    
  4. public class Program
  5. {
  6.     public static void Main()
  7.     {
  8.        
  9.         int hours=int.Parse(Console.ReadLine());
  10.         int minutes=int.Parse(Console.ReadLine());
  11.  
  12.         TimeSpan ts=new TimeSpan(hours,minutes,0);
  13.         TimeSpan tsAdd=new TimeSpan(0,15,0);
  14.         ts+=tsAdd;
  15.         Console.WriteLine(ts.ToString(@"hh\:mm"));
  16.        
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement