In C++ program you can write a program to calculate the factorial of an integer . Let's look at the code to calculate the factorial of an integer. #include <iostream> using namespace std ; int main () { int i, num, fact=1 ; cout <<"\n Enter integer" ; cin>> num; i = num ; while (num) { fact *=num ; --num ; } cout<< "The factorial of " << i ; cout<<"is" << fact <<"\n" ; return 0 ; } The output of the C++ Code C++ Program to calculate the factorial of an integer
Learn C++ Programming fast and easy, find C++ Program Codes