C++ program to find factorial
C++ program to find factorial
Hello guys today i will tell how make a program that will find factorial of number.Factorial is the product of a integer and integers below it.it is represented by "!" mark.For example factorial of 5 will be:-5!=5x4x3x2x1=120
So the coding for the factorial is:-
________________________________________________________________________________
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,i,b=1;
cout<<"\t\t\t\tFACTORIAL CHART\t\t\t\t";
cout<<"\n\nEnter the number whose factorial you want:";
cin>>a;
for(i=1;i<=a;i++)
{
b*=i;
}
cout<<"Factorial of the number will be:"<<b;
getch();
}
#include<conio.h>
void main()
{
clrscr();
int a,i,b=1;
cout<<"\t\t\t\tFACTORIAL CHART\t\t\t\t";
cout<<"\n\nEnter the number whose factorial you want:";
cin>>a;
for(i=1;i<=a;i++)
{
b*=i;
}
cout<<"Factorial of the number will be:"<<b;
getch();
}
_________________________________________________________________________________
You can download the coding by clicking on downloading icon↴
So after downloading the file when you will run the program the output will be like this:-
So if you want to do changes than go for it!!
If you want any other C++ programm guidence than comment below i will help you out!!!
#For more C++ coding visit this site:-
Comments
Post a Comment