Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- int no,i;
- Console.Write("Enter your Number");
- no = Convert.ToInt16(Console.ReadLine());
- for (i = 2; i <= no - 1; i++)
- {
- if (no % i == 0)
- {
- Console.WriteLine("Not a Prime Number");
- break;
- }
- }
- if (i == no)
- {
- Console.WriteLine("It is a Prime Number");
- }
- }
- }
Add Comment
Please, Sign In to add comment