Advertisement
Guest User

Untitled

a guest
Dec 27th, 2011
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int i = 1, szam = 0, db = 0;
  13.             szam = int.Parse(Console.ReadLine());
  14.             while (i <= szam)
  15.             {
  16.                 if (szam % i == 0)
  17.                 {
  18.                     db++;
  19.                 }
  20.                 i++;
  21.             }
  22.             if (db == 2)
  23.                 Console.WriteLine("Prím");
  24.             else
  25.                 Console.WriteLine("Nem prím");
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement