Advertisement
VEGASo

(С#) Lab #3 Ex. 4

Oct 15th, 2022
559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2.  
  3. namespace LearnRSUE
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             int a = 0;
  10.  
  11.  
  12.             Console.Write("Введите число: ");
  13.             a = Convert.ToInt32(Console.ReadLine());
  14.  
  15.             if (a % 2 != 0 && a % 3 != 0 && a != 1 && a % 5 != 0)
  16.             {
  17.                 Console.WriteLine("Простое");
  18.             }
  19.             else if (a == 2 || a == 3 || a == 5)
  20.             {
  21.                 Console.WriteLine("Простое");
  22.             }
  23.             else
  24.             {
  25.                 Console.WriteLine("Не простое");
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement