Write a python program to generate the product of 10 natural numbers
Answers
Answered by
0
n*(n+1)/2
I hope this will help you
if not then comment me
I hope this will help you
if not then comment me
Answered by
0
Natural numbers start from 10 and the first 10 natural numbers would be:
1,2,3,4,5,6,7,8,10
Now, to get the sum, we can either use the mathematical formula or use python functions to solve it. In my opinion, using the mathematical formula is an easy way out of this but using the python functions to solve this is useful for the future. Anyway, I will show you both methods. First the python way and then using the mathematical formula.
prod = 1
for i in range(1,11):
prod = prod * i
print(product)
Now using the mathematical formula n*(n+1)/2. We now that n in 10 all we have to do is print it.
print((10*(10+1))/2)
Similar questions
Chemistry,
6 months ago
Economy,
6 months ago
Math,
6 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Math,
1 year ago