Program to Print Factorial of a Number in C
There are lots of ways to print factorial of a number in C programming languages. I have listed down some common methods to print factorial of a number in C.
Ways to Print factorial of a Number
- Factorial of Number using for Loop.
- Factorial of a Number using While loop.
- Factorial of a Number using do While loop.
- Factorial of a Number using Recursion.
- Factorial of a Number using Function call.
What is the Factorial of a Number in C?
Factorial of a number (N) is defined as the product of all numbers from 1 to N.Logic used in all the methods to print factorial of a number is that we will input a number from the user and then multiplying all numbers by decreasing/increasing it until the loop reaches 1 or N. Above code is for only Positive numbers You can add an If else statement to check whether a number is positive or negative. If the number is negative then Output should be " Negative number's Factorial doesn't exist.
Find Factorial of a number using For loop in C
Another way to find the factorial of a number using c
Find Factorial of a number using While loop in C
Find Factorial of a number using Do While loop in C
Find Factorial of a Number using Recursion in C
Recursion means accessing the function itself in the same function.
Also Read - C programming interview questions
Find Factorial of a number using Function in C
You can try your own logic to find factorial of a number In C Programming Langauge in various other ways.
Learn Various Languages with Us Explore our various other Informative posts.