<br />#include<iostream> #include<conio.h> using namespace std; int main() { int n,m=1; cout<<"Enter the value of n : "; cin>>n; if(n<0) { cout<<endl<<"Factorial of "<<n<<" is infinity"<<endl; } else { for(int i=1;i<=(n);i++) { m=m*i; } cout<<endl<<"Factorial of "<<n<<" is : "<<m<<endl; } cout<<endl<<" @Myprogworld.....!!!!"; getch(); return 0; }
Output:-