/******************************************************/ /* Introduction to Programming */ /* By Dr. ANTF */ /* www.antf.net */ /* Copyright 2015 */ /* */ /* C# 306 - Problem 5: Prime Numbers (a) */ /******************************************************/ 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) { Console.WriteLine("\nNot Prime"); break; } } if (i == n) Console.WriteLine("\nPrime"); Console.ReadKey(); } } }