fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int i, no, fact=1;
  7. cout<<"Enter the any no. : ";
  8. cin>>no;
  9. if(no==1)
  10. {
  11. cout<<"fact = 0";
  12. }
  13. for(i=1;i<=no;i++)
  14. {
  15. fact=fact*i;
  16. }
  17. cout<<"Factorial: "<<fact;
  18. return 0;
  19. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Enter the any no. : Factorial: 1