LATEST PROGRAMS

WAP in C++ to find the factorial of a number.

#include<iostream>
using namespace std;

int main()
{
    int n;
    cout<<"Enter the number whose factorial is to be checked :\n";
    cin>>n;
    int fact=1;
    for(int i=1;i<=n;i++)
    {
        fact*=i;
    }
    cout<<"The factorial of the number "<<n<<" is : "<<fact;
    return 0;
}
18/02/2023, 10:13 am Read : 52 times