Calculate Factorial

Write a program that will read an integer N from STDIN and compute the factorial of N. The input to your program will contain many lines. On each line there will be exactly one integer. Your program should print the factorial of each integer in a separate line. Your program should terminate when it reads a number that is not positive.

1 <= N <= 15

 

Sample Input

1
2
3
-1

 

Sample Output

1
2
6


Download Test Case

You may also like

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments