Write a C++ program to calculate the factorial of a given number. .


#include <iostream>
using namespace std;
void main()
{
int i,f=1,num;

  cout<<"Input the number : ";
  cin>>num;
  for(i=1;i<=num;i++)
      f=f*i;
  cout<<"The Factorial of "<<num<<"is"<<f<<endl;
       system ("pause");
}
Write a C++ program to calculate the factorial of a given number. . Write a C++ program to calculate the factorial of a given number. . Reviewed by Unknown on May 18, 2017 Rating: 5

No comments:

Powered by Blogger.