Menu Close

Print the given series: 1 1 2 6 24

Create a program to print the given series up to first n digits.
Refer sample input and output.
The given series is: 1 1 2 6 24

N=int(input("Enter the n digit number: "))
print(1,end=" ")
d=1
for i in range(1,N):
	d*=i
	print(d,end="")
	print(" ",end='')
print()

Input:
Enter the n digit number: 6

Output:
1 1 2 6 24 120


Exec. on linux

Morae!Q!