Lucian_Adrian

#898 SumFactCif

Feb 12th, 2022
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. int sumfactcif(int n)
  2. {
  3. if(n == 0)
  4. return 1;
  5. int s = 0;
  6. while(n)
  7. {
  8. int a = n % 10, p = 1;
  9. for(int i = 1 ; i <= a ; i++)
  10. p *= i;
  11. s += p;
  12. n /= 10;
  13. }
  14. return s;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment