using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace net
{
class Hello
{
static void Main()
{
int count = 0;
for (int i = 101; i < 200; i++)
{
if (SuShu(i))
{
count++;
Console.Write(i + " ");
}
}
Console.WriteLine();
Console.WriteLine("个数=" + count);
}
static bool SuShu(int m)
{
bool isSushu = true;
for (int i = 2; i < Math.Sqrt(m)&&isSushu; i++)
{
if (m % i == 0)
{
isSushu = false;
}
}
return isSushu;
}
}
}
101到200间的素数及其个数
最新推荐文章于 2021-03-26 12:03:01 发布