访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容
using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.Write("2 is prime\n"); for (int p = 3; p <= 1000; p+=2) { bool Is = true; for (int i = 2; i <= Math.Sqrt((double)p); i++) if (p % i == 0) { Is = false; break; } if (Is) Console.Write(p + " is prime\n"); } Console.ReadLine(); } } }