Important Questions

C++ Program to Find Factorial

//C++ Program to Find Factorial
//header files
#include<iostream.h>
#include<conio.h>

void main()
{

clrscr();
unsigned long n, factorial = 1;
cout << "Enter a positive integer to find its factorial: ";
cin >> n;
for(int i = 1; i <=n; i++)
{

factorial *= i;

}
cout << "Factorial of " << n << " = " << factorial;
getch();

}

Output


You can also see a video how to run this program