fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. int number ,fact=1;
  7.  
  8. for(number=0;number<10;number++)
  9. {
  10. for(int i=1;i<=number;i++)
  11. fact=fact*i;
  12. cout<<"the factorial of "<< number <<" is "<<fact<<"\n";
  13. fact=1;
  14.  
  15. }
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 4520KB
stdin
Standard input is empty
stdout
the factorial of 0 is 1
the factorial of 1 is 1
the factorial of 2 is 2
the factorial of 3 is 6
the factorial of 4 is 24
the factorial of 5 is 120
the factorial of 6 is 720
the factorial of 7 is 5040
the factorial of 8 is 40320
the factorial of 9 is 362880