/******************************************************/ /* Introduction to Programming */ /* By Dr. ANTF */ /* www.antf.net */ /* Copyright 2015 */ /* */ /* C# 306 - Problem 5: Prime Numbers (d) */ /******************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DOS { class Program { static void Main(string[] args) { int n, i; Console.Write("Enter a number: "); n = int.Parse(Console.ReadLine()); for (i = 2; i < n; i++) if (n % i == 0) break; if (i == n) Console.WriteLine("\nPrime"); else Console.WriteLine("\nNot Prime"); Console.ReadKey(); } } }