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

Popular posts from this blog

8.c++ program to check whether the number is even or odd

1.c++ program to find the total marks and average of three subjects

4.c++ program to compute quotient and remainder