C ++ program to find factorial of n numbers
Answers
Answered by
7
Question :
To Write a program to find factorial of n numbers.
Answer :
Required Program :
To Find factorial of a number ;
#include <iostream>
using namespace std;
int main ( )
{
int n, i, fact= 1 ;
cout <<"Enter Number to find the factorial : ";
cin>>n ;
for ( i = 1 ; i<=n ; i++ )
fact = fact * i ;
cout <<" Factorial of " <<n<<" is "<< fact ;
}
Output :
Enter number to find the factorial : 6
Factorial of 6 is 720
Structure Of C++ Program :
// comment line
#include <iostream>
using namespace std;
int main ( )
{
.......
Body of the Program ;
.......
return 0 ;
}
Similar questions