fork download
  1. namespace Problem_3.Back_in_30_Minutes
  2. {
  3. using System;
  4.  
  5. public class Program
  6. {
  7. public static void Main()
  8. {
  9. var hour = int.Parse(Console.ReadLine());
  10. var minutes = int.Parse(Console.ReadLine());
  11.  
  12. //if the hours are 23
  13. var formattedHours = (minutes > 29 && hour == 23) ? hour = 0 : hour;
  14.  
  15. /* if the minutes are higher than 29
  16.   * the hours are increased with 1
  17.   * if not the hours don't change */
  18. formattedHours = minutes > 29 && formattedHours !=0 ? hour+=1 : hour;
  19.  
  20. /* the minutes are increased with 30
  21.   * if the minutes are lower than sixty
  22.   * they don't change, else -> they
  23.   * are equal to minutes - 60 */
  24. var formattedMinutes = minutes > 29 ? minutes += 30 - 60 : minutes += 30;
  25.  
  26. Console.WriteLine($"{formattedHours}:{formattedMinutes.ToString("#00")}");
  27. }
  28. }
  29. }
Runtime error #stdin #stdout #stderr 0.01s 134976KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Unhandled Exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: String
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00006] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Int32.Parse (System.String s) [0x00007] in <8f2c484307284b51944a1a13a14c0266>:0 
  at Problem_3.Back_in_30_Minutes.Program.Main () [0x00005] in <b0e51e59c3334c32b81e8b9b7fce1ace>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
Parameter name: String
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00006] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Int32.Parse (System.String s) [0x00007] in <8f2c484307284b51944a1a13a14c0266>:0 
  at Problem_3.Back_in_30_Minutes.Program.Main () [0x00005] in <b0e51e59c3334c32b81e8b9b7fce1ace>:0