Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Product
- {
- static void Main()
- {
- Console.Write("n = ");
- int n = Int32.Parse(Console.ReadLine());
- Console.Write("m = ");
- int m = Int32.Parse(Console.ReadLine());
- if (n < m)
- {
- int num = n;
- decimal product = 1;
- do
- {
- product *= num;
- num++;
- }
- while(num <= m);
- Console.WriteLine("product[n..m] = " + product);
- }
- else
- {
- Console.WriteLine("Error: n should be smaller than m.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment