fork download
  1. //wap to find the factorial of a number.(Method-1)
  2.  
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main() {
  7. // your code goes here
  8. int n;
  9. cout<<"enter the number";
  10. cin>>n;
  11. int fact=1;
  12. for(int i=5;i>0;i--){
  13. fact=fact*i;
  14. }
  15. cout<<fact;
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
enter the number120