Preview:
#include<bits/stdc++.h>
using namespace std;
int fact(int n)
{
    int m=1;
    for(int i=1;i<=n;i++)
    {
        m=m*i;
    }
    return m;
}
int main()
{
    int n;
    cin>>n;
    cout<<"Factorial of number is: "<<fact(n);
    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter