Factorial of a number in ‘C’

Do you know how to find the factorial of a given number? The factorial of a given number can be found by calculating the product of the sequence of numbers till the number, beginning from 1.

As an example, factorial of 5 can be found as

5*4*3*2*1

which is equal to 120

Similarly, factorial of 6 is

6*5*4*3*2*1

which is equal to 720

How do we program this in ‘C’? Let us see below:

This is the result you will get when you run the program in any compiler.

You can try running the above code by means of this online compiler

Online C Compiler – Programiz

This is the next post for the BlogchatterHalfMarathon challenge by @blogchatter

(Visited 35 times, 1 visits today)

Related Posts

4 thoughts on “Factorial of a number in ‘C’

Leave a Reply