fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int num;
  6. cout<<"ingrese el numero: "<<endl;
  7. cin>>num;
  8. if(num==0 || num==1){
  9. cout<<1<<endl;
  10. } else{
  11. long factorial=1;
  12. for(int i=2; i<=num;i++){
  13. factorial*=i;
  14. }
  15. cout<<factorial<<endl;
  16. }
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5272KB
stdin
Standard input is empty
stdout
ingrese el numero: 
1