#C12948. List Factorial Calculator
List Factorial Calculator
List Factorial Calculator
You are given a list of non-negative integers. For each integer n in the list, compute its factorial defined as \( n! = n \times (n-1)! \) with the base case \( 0! = 1 \).
The task is to calculate the factorial for each integer in the input list and print the results on a single line with spaces separating the outputs.
inputFormat
The first line of input contains an integer n which represents the number of elements in the list. The second line contains n space-separated non-negative integers.
outputFormat
Output a single line containing the factorial of each input integer in the same order as given, with each value separated by a space.
## sample3
3 4 5
6 24 120