How to Print factorials of a number in C++
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
cout<<"www.moznum.blogspot.com"<<endl<<endl;
int i,n,c=1;
cout<<"Enter a number: ";
cin>>n;
for(i=1;i<=n;i++)
{
c=c*i;
}
cout<<"Factorial of "<<n<<" is: "<<c<<endl;
getch();
}
You can also find this topic by:
Write a C++ Program which Find and print the factorials of a number which is taken by the user or as input.
No comments:
Post a Comment