Ответ:
int n = Convert.ToInt32(Console.ReadLine());
bool result = true;
for (int i = 2; i <=Math.Sqrt(n); i++)
{
if(n%i==0)
{ result = false; }
}
if(result)
{ Console.WriteLine("Prime"); }
else
{ Console.WriteLine("Not prime"); }
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
int n = Convert.ToInt32(Console.ReadLine());
bool result = true;
for (int i = 2; i <=Math.Sqrt(n); i++)
{
if(n%i==0)
{ result = false; }
}
if(result)
{ Console.WriteLine("Prime"); }
else
{ Console.WriteLine("Not prime"); }