fork download
  1. #include <iostream>
  2. using namespace std;
  3. #include <cstdlib>
  4. int fact(int);
  5. int main() {
  6. int a;
  7. do
  8. {
  9. cout<<"input am integer:";
  10. cin>>a;
  11. }while(a<=0);
  12.  
  13. cout<<"1*2*...*"<<a<<"="<<fact(a)<<endl;
  14. system("pause");
  15. return 0;
  16. }
  17. int fact (int a)
  18. {
  19. if(a>0)
  20. return(a*fact(a-1));
  21. else
  22. return 1;
  23. }
Success #stdin #stdout #stderr 0.01s 5284KB
stdin
Standard input is empty
stdout
input am integer:1*2*...*21880=0
stderr
sh: 1: pause: not found