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.
Calculate factorial of the ceiling of a float number
Report a typo
Sample Input 1:
3.6Sample Output 1:
24Sample Input 2:
-2.9Sample Output 2:
-1Write 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
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.