c++ programe to find factorial of a number using for loop |
C++ Program to find the Factorial of a Number using For Loop:
This is the C++ Program to find the Factorial of a Number using For Loop.To find factorial of a number in c++ is very easy.You can easily follow these steps to find factorial of a number in C++:
1)#include <iostream>
2)using namespace std;
3)int main()
4){
5)int i,fact=1,number;
6)cout<<"Enter any Number: ";
7)cin>>number;
8)for(i=1;i<=number;i++){
9)fact=fact*i;
10)}
11)cout<<"Factorial of " <<number<<" is: "<<fact<<endl;
12 return 0;
13)}
DESCRIPTION:
This is a c++ program to find the factorial of a number using for loop.To find the factorial of a number in c++ is very easy using for loop.we take the number from the user to find the factorial of a number in c++ using for loop.The formula which is used in line no 9 is used to find factorial of a number.
c++ program to find the factorial of a number using for loop |
You can easily find factorial of a number in c++ using for loop.you can easily use while or do while loop to find factorial of a number in c++.You have to write these coding lines in c++ to find factorial of a number using for loop.
0 Comments