fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int i,n,f=1;
  5. cin>> n;
  6. for(i=1; i<=n; i++)
  7. { f=f*i ; }
  8. cout<<"THE FACTORIAL IS" <<" " <<f ;
  9. }
Success #stdin #stdout 0s 4548KB
stdin
5
stdout
THE FACTORIAL IS 120