Product of Numbers from M to N
Given two integers M, N. Write a program to print the product of numbers in the range M and N (inclusive of M and N).
Input
The first line of input is an integer M. The second line of input is an integer N.
Explanation
In the given example, the product of numbers between the range
2 and 5 is 2 * 3 * 4 * 5. Therefore, the output should be 120.
Sample Input 1
2
5
Sample Output 1
120
Sample Input 2
1
4
Sample Output 2
24
M = int(input())
N = int(input())
product = 1
for i in range(M, N+1):
product *= i
print(product)
Comments
Leave a comment