fork download
  1. using System; using System.Text; // PRIME_numb.cs DANILIN
  2. namespace p10001 // 1 second 10001 104743
  3. { class Program // rextester.com/ZBEPGE34760
  4. { static void Main(string[] args)
  5. { int max=10001; int n=1; int p=1; int f; int j; long s;
  6. while (n <= max)
  7. { f=0; j=2; s=Convert.ToInt32(Math.Pow(p,0.5));
  8. while (f < 1)
  9. { if (j >= s)
  10. { f=2; }
  11. if (p % j == 0) { f=1; }
  12. j++;
  13. }
  14. if (f != 1) { n++; } // Console.WriteLine("{0} {1}", n, p);
  15. p++;
  16. }
  17. Console.Write("{0} {1}", n-1, p-1);
  18. Console.ReadKey();
  19. }}}
Runtime error #stdin #stdout #stderr 0.13s 31420KB
stdin
Standard input is empty
stdout
10001 104743
stderr
Unhandled exception. System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
   at System.ConsolePal.ReadKey(Boolean intercept)
   at System.Console.ReadKey()
   at p10001.Program.Main(String[] args) in /home/hP4JIV/Project/Program.cs:line 18