Calculate factorial of the ceiling of a float number

Report a typo

Write a program that takes a float number as input and calculates the factorial of that number's ceil value after discarding the decimal part (ignore everything after the decimal point). For instance, if the input is 3.6, calculate the factorial for 4 (because the ceiling of 3.6 is 4). If the input number is less than 0, print -1 to indicate an error.

Sample Input 1:

3.6

Sample Output 1:

24

Sample Input 2:

-2.9

Sample Output 2:

-1
Write a program in Python 3.10
# Importing necessary function from math library
from math import ceil, factorial

# Defining factorial function to calculate factorial of ceil value of a float
def float_ceil_factorial(n):
# Write your code here.


# Taking input from user
n = float(input())

# Calling the function with the user input
output = float_ceil_factorial(n)

# Printing the output
print(output)

Create a free account to access the full topic