SHARE
TWEET

Untitled

a guest Sep 16th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Console.WriteLine("Írj be egy számot");
  2.             int a = Convert.ToInt32(Console.ReadLine());
  3.             if (a == 0 && a == 1)
  4.             {
  5.                 Console.WriteLine("Ez a szám nem prímszám: {0}", a);
  6.                 Console.ReadLine();
  7.             }
  8.             else
  9.             {
  10.                 for (int i = 2; i <= a / 2; i++)
  11.                 {
  12.                     if (a % i == 0)
  13.                     {
  14.                         Console.WriteLine("Ez a szám nem prímszám: {0}", a);
  15.                         Console.ReadLine();
  16.                         return;
  17.                     }
  18.  
  19.                 }
  20.                 Console.WriteLine("Ez a szám prímszám: {0}", a);
  21.                 Console.ReadLine();
  22.             }
  23.             Console.ReadKey();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top