Monday 25 April 2016

C++ programming : Factorial of a number

This Program will show you how to Find a Factorial of any Number using C++ Language



Program # 1 : How to find a Factorial of a Number :


#include <iostream>

using namespace std;

int main()
{

  int a, num, fact = 1;
  cout << "Enter the Number To Find Its Factorial: \n";
  cin >> num;
  for(a=1; a<=num; a++)
    fact = fact*a;
  cout << "The Factorial of Number is: \n" << fact << endl;
    return 0;
}

Output of the Program : 



0 comments:

Post a Comment