Menu
Coddy logo textTech

Factorial

Lesson 11 of 20 in Coddy's Beginner Challenges - Practice Basic Concepts course.

challenge icon

Challenge

Easy

Write a function named fact that gets num and returns the factorial of num.

Examples,

  • Factorial of 6 (6!)  ->  1 * 2 * 3 * 4 * 5 * 6 = 720
  • Factorial of 3 (3!)  ->  1 * 2 * 3 = 6

Try it yourself

int fact(int num) {
    // Write code here
}

All lessons in Beginner Challenges - Practice Basic Concepts