static void Main(string[] args) { IPrimeNumbers primeNumbers; primeNumbers = new PrimeNumbers(); Console.WriteLine("Enter the number of prime numbers you want"); int num = Convert.ToInt32(Console.ReadLine()); var prime = primeNumbers.GeneratePrimeNumbers(num); Console.Write("\t"); foreach (int p in prime) { Console.Write(p + "\t"); } Console.Write("\n"); foreach (int p in prime) { Console.Write(p + "\t"); foreach (int n in prime) { if (p > 0) { Console.Write(p * n + "\t"); } else { Console.Write(n + "\t"); } } Console.Write("\n"); } Console.ReadLine(); }
public static void Main() { Console.WriteLine("Enter a number to find all prime numbers below or including the number:"); string userInput = Console.ReadLine(); int input = int.Parse(userInput); Console.WriteLine("Here are the prime numbers"); Console.WriteLine("smaller than or equal to " + input); PrimeNumbers.PrimeMethod(input); }