Factorial Program In Cpp Language

Finding Factorial  Numbers with Cpp programming Language?


#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    int num [10];
    for(int i=0; i<10; i++)
{
int factorial=1;
cout<<" Enter Number To Find Its Factorial:  ";
    cin>>num[i];
    if(num[i]!=0)
    {
    for(int a=1;a<=num[i];a++)
    {
        factorial=factorial*a;
    }
cout<<"Given Number is "<<num[i]<<"      & Factorial is  ="<<factorial<<endl;
}
else cout<<"Zero Have No Factorial"<<endl;
}

getch();
}

Comments

Popular posts from this blog

Even/Odd Number Checking Code in CPP

Calculating Name and Marks in Cpp

Triangle of Characters(CPP)