fork download
  1. using System;
  2.  
  3. namespace laba1
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. var answer = new Random().Next(100);
  10. var guess = int.Parse(Console.ReadLine());
  11. var triesLeft = 7;
  12. while (guess != answer)
  13. {
  14. Console.WriteLine($"Too {(guess < answer ? "small":"big")}");
  15. Console.WriteLine($"You have {triesLeft} tries left.");
  16. guess = int.Parse(Console.ReadLine());
  17. if (triesLeft-- == 0)
  18. {
  19. Console.WriteLine("You lost.");
  20. return;
  21. }
  22. }
  23. Console.WriteLine("You win");
  24. }
  25. }
  26. }
  27.  
Runtime error #stdin #stdout #stderr 0.02s 16216KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Unhandled Exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: s
  at System.Int32.Parse (System.String s) [0x00003] in <6649516e5b3542319fb262b421af0adb>:0 
  at laba1.Program.Main (System.String[] args) [0x00012] in <f913f4231b8c4016b64dc3b55b8ceb48>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
Parameter name: s
  at System.Int32.Parse (System.String s) [0x00003] in <6649516e5b3542319fb262b421af0adb>:0 
  at laba1.Program.Main (System.String[] args) [0x00012] in <f913f4231b8c4016b64dc3b55b8ceb48>:0