Answer to Question #229159 in Python for kaavya

Question #229159

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




1
Expert's answer
2021-08-25T17:30:07-0400
M = int(input())
N = int(input())
product = 1
for i in range(M, N+1):
    product *= i
print(product)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS