static void Main(string[] args) { Write("Enter a number between 1 and 1000: "); if (int.TryParse(ReadLine(), out int number)) { WriteLine(format: "Prime factors of {0} are: {1}", arg0: number, arg1: Primes.PrimeFactors(number)); } }
public void PrimeFactorsOf40() { // arrange int number = 40; string expected = "5 x 2 x 2 x 2"; // act string actual = Primes.PrimeFactors(number); // assert Assert.Equal(expected, actual); }
public void PrimeFactorsOf99() { // arrange int number = 99; string expected = "11 x 3 x 3"; // act string actual = Primes.PrimeFactors(number); // assert Assert.Equal(expected, actual); }