CodeTestValidate

No installations needed! Write Python directly in your browser and get instant feedback with our smart validation system.

Challenge # 5

Calculate Factorial

Objective

Compute the factorial of a given non-negative integer.

Instructions

  • You are given a non-negative integer variable n.

  • The factorial of n (written as n!) is the product of all positive integers less than or equal to n.

  • Calculate and print the factorial of n.

Constraints:
Do not use input(). • `n` will be a non-negative integer.
Exemple IO

Input: n = 5

Output: 120

Input: n = 0

Output: 1

Input: n = 3

Output: 6

Try It Online!

Output:

Validate Your Results

Get your code reviewed and validated to understand what you did right and where you can improve.

Previous challengePrint Multiplication TableNext challengeCheck Palindrome
Loading...