fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. string name;
  8. int count=0;
  9. int age;
  10.  
  11. Console.WriteLine("Enter your name and your age");
  12. name = Console.ReadLine();
  13. age = int.Parse(Console.ReadLine());
  14. if(age<18)
  15. {
  16. while(age<18)
  17. {
  18. count ++;
  19. }
  20. Console.WriteLine(count + "years for 18!");
  21. }
  22. else
  23. Console.WriteLine("your age is " + age);
  24. }
  25. }
Runtime error #stdin #stdout #stderr 0.01s 134848KB
stdin
13
stdout
Enter your name and your age
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 Test.Main () [0x00017] in <6626030ba6ff4b1b98aecd334ad3e475>: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 Test.Main () [0x00017] in <6626030ba6ff4b1b98aecd334ad3e475>:0