Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class PrimeNumbers
- {
- static void Main()
- {
- int number = int.Parse(Console.ReadLine());
- int divByTwo = number / 2;
- int divByThree = number / 3;
- int divByFive = number / 5;
- if (number > 0)
- {
- Console.WriteLine((number != 2 && number == divByTwo * 2) || (number != 3 && number == divByThree * 3) || (number != 5 && number == divByFive * 5) ? "The number is Prime!" : "The number is NOT Prime!");
- }
- else Console.WriteLine("The number is not Prime!");
- Main();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement