Respuesta :

Answer:

The program is written in python and it doesn't make use of any comment;

(See explanation section for line by line explanation)

def getN(num):

     fact = 1

     for i in range(1, 1 + num):

           fact = fact * i

     print("Factorial: ",fact)

num = int(input("Number: "))

if num < 0:

     print("Invalid")

else:

     getN(num)

Explanation:

The function getNum is defined here

def getN(num):

Initialize the result of the factorial to 1

     fact = 1

Get an iteration from 1 to the user input number

     for i in range(1, 1 + num):

Multiply each number that makes the iteration

           fact = fact * i

Print result

     print("Factorial: ",fact)

Ths line prompts user to input number

num = int(input("Number: "))

This line checks if user input is less than 0; If yes, the program prints "Invalid"

if num < 0:

     print("Invalid")

If otherwise, the program calls the getN function

else:

     getN(num)