Wednesday, 7 October 2015

Write a CPP Program To Find Factorial Of Input Number

Write a CPP Program To Find Factorial Of Input Number
1:  #include<iostream.h>  
2:  #include<stdio.h>  
3:  int main()  
4:  {  
5:    int n,fact=1;  
6:    cout<< "Enter number"<<endl;  
7:    cin>>n;  
8:    for(;n>0;n--)  
9:    {  
10:      fact=fact*n;  
11:    }  
12:    cout<< "Factorial = "<<fact<<endl;  
13:  }  

No comments:

Post a Comment