14.c++ program to find factorial


// C++ program to find factorial of a given number

INPUT:

#include <iostream>

using namespace std;

int main()

{

    int n,i;

    long double fact =1;

    cout<<"Enter a positive number : ";

    cin>>n;

    for(i=1;i<=n;i++){

            fact = fact * i;

    }

    cout<<"\n Factorial of " <<n<<" is : "<<fact<<endl;

    return 0;

}

OUTPUT:








Comments