Explore a little.C ProgrammingC++HTMLVisual BasicSystem AnalysisE-CommerceBCA Notes
LEARN SOMETHING NEW

C++ Program to Find Factorial

Read4BCA learning libraryFree access

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

C++ Program to Find Factorial example

You can also see a video how to run this program

This lesson preserves the original Read4BCA material. Some programming examples use older tools and syntax. View original page.