Monday, 25 May 2015

How to find factorial of a number in c++

#include<iostream.h>
#include<conio.h>

void main()
  {
    clrscr();
    int n,m=1;
    cout<<"Enter the number to cal. Factorial\n";
    cin>>n;

    for(int i=1;i<=n;i++)
     {
     m=m*i;
     }

     dcout<<m;
     getch();
   }
    
Coding Format

Output Format

       

No comments:

Post a Comment