Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- while (true)
- {
- Console.WriteLine("Введите первое число");
- int N = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Результат "+ isSimple(N));
- }
- }
- static bool isSimple(int N)
- {
- if( N <= 1)
- {
- return false;
- }
- if( N == 2)
- {
- return false;
- }
- bool si = true;
- int i = N-1;
- while(i > 0)
- {
- if (i > 1)
- {
- if (N % i == 0)
- {
- si = false;
- }
- }
- i--;
- }
- return si;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement