jae-l
1/2/2017 - 5:05 PM

Finds the product in a range [n...m].

Finds the product in a range [n...m].

Console.Write("n = ");
int n = int.Parse(Console.ReadLine());

Console.Write("m = ");
int m = int.Parse(Console.ReadLine());

int num = n;
long product = 1;
do
{
  product *= num;
  num++;
} while (num <= m);

Console.WriteLine("product[n. . .m] = " + product);