## Write a C C++ program to find factorial of given number

Switch statement और multibranching statements के बारे में अधिक जानने के लिए देखें—Switch statements in C

Looping और iterative statements के बारे में और अधिक जानने के लिए देखें— Looping statements in C

Unconditional branching statements के बारे में अधिक जानकारी के लिए देखें— Break, Continue and Goto in C

### Flowchart to find factorial of given number

### C program to find factorial of given number

```
#include<stdio.h>
int main()
{
int num,c=1,res=1;
printf("Enter a number: ");
scanf("%d",&num);
while(c<=num)
{
res=res*c;
c++;
}
printf("Factorial = %d",res);
return 0;
}
```

### C++ program to find factorial of given number

```
#include<iostream>
using namespace std;
int main()
{
int num,c=1,res=1;
cout<<"Enter a number: ";
cin>>num;
while(c<=num)
{
res=res*c;
c++;
}
cout<<"Factorial = "<<res;
return 0;
}
```

### Output of C C++ program to find factorial of given number

Enter a number: 3 Factorial = 6

Enter a number: 4 Factorial = 24

Enter a number: 5 Factorial = 120

### Related programs in C C++

- Generate series of natural numbers (while, for, do while)
- Generate series of natural numbers and their sum
- Generate series of odd numbers and find their sum
- Generate series of even numbers and find their sum
- Generate table of given number
- Find power of given number
- Generate multiplication table of given number
- HCF and LCM of two numbers
- Generating Fibonacci series
- Checking prime number
- Generating series of prime numbers
- Sum of digits of given number
- Reverse of digits of given number
- Checking palindrome number
- Checking Armstrong number
- Generating series of Armstrong numbers
- Convert decimal to binary
- Convert binary to decimal