Friday 22 June 2012

Lecture: 99


                                                Lecture 99

#include <iostream>
#include <conio.h>
using namespace std;
 main ()
{  
  system("CLS");//Clear screen
  int F=1,i=1,j;
  cout<<"Enter the factorial number: ";
  cin>>j;
  i=1;
   while(i<=j)
     {
       F=F*i;
       i++;
     }
   cout<<"Factorial of "<<j<<" = "<<F;
  getch();
  return 0;
}

Code view in dev compiler:

Compile the program Ctrl+F9

      Run program Ctrl+F10