Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int F(int n)
  5. {
  6. if(n==0)
  7. return 1;
  8. else
  9. return n*F(n-1);
  10. }
  11.  
  12. int sumacifre(int n)
  13. {
  14. if(n<=9)
  15. return n;
  16. else return sumacifre(n/10+n%10);
  17. }
  18.  
  19. int main()
  20. {
  21. int n;
  22. cin>>n;
  23. cout<<F(n)<<'\n';
  24. cout<<sumacifre(n);
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement