Wednesday

Program to calculate the factorial of an integer.

#include < iostream.h >
#include < conio.h >
int main( )
{
    clrscr( );
    int i, num, fact = 1;
    cout<<"\nEnter Number :";
    cin>>num;
    i = num;
    while (num)
    {
       fact* = num;
       - - num;
     }

  
   
cout<<" The factorial of "<< i <<" is " << fact <<" \n ";
    return 0;
}
 

0 comments:

Post a Comment

Thanks for leaving a comment. As soon as it's approved, it will appear.