Advertisement
MT_Linkin

prosto 4islo

Oct 28th, 2021
828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2.  
  3. namespace prosto_4islo
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             int counter = 0;
  12.             for (int i = 1; i <= n; i++)
  13.             {
  14.                 if (n % i == 0)
  15.                 {
  16.                     counter++;
  17.                 }
  18.             }
  19.  
  20.             if (counter == 2)
  21.             {
  22.                 // prosto  
  23.                 Console.WriteLine("Prime");
  24.             }
  25.             if (counter > 2)
  26.             {
  27.                 Console.WriteLine("NonPrime");
  28.             }
  29.  
  30.            
  31.         }
  32.     }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement