fork download
  1. # include <iostream>
  2. # include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main ()
  7. {
  8. int input = 1;
  9. cout << "input your number : \n";
  10. cin >> input;
  11.  
  12. int faktorial = 1;
  13.  
  14. for(int i=1;i<=input;i++)
  15. {
  16. faktorial = faktorial * i;
  17. }
  18. cout << "factorial value from number " << input << " is " << faktorial << endl;
  19. }
Success #stdin #stdout 0s 4532KB
stdin
5
stdout
input your number : 
factorial value from number  5 is 120