Boris-Stavrev92

Untitled

Jun 7th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _15.Fast_Prime_Checker
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14.  
  15. int n = int.Parse(Console.ReadLine());
  16.  
  17. for (int i = 2; i <= n; i++)
  18. {
  19. bool check = true;
  20. for (int g = 2; g <= Math.Sqrt(i); g++)
  21. {
  22. if (i % g == 0)
  23. {
  24. check = false;
  25. break;
  26. }
  27. }
  28. Console.WriteLine($"{i} -> {check}");
  29. }
  30.  
  31.  
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment