Advertisement
Guest User

2 solution C b

a guest
Feb 20th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3.  
  4. int help(int num)
  5. {
  6.     if (num>9)
  7.         return 10*help(num/10);
  8.    
  9.     return 1;
  10. }
  11.  
  12. int func(int num)
  13. {
  14.     if(num<10)
  15.         return num;
  16.        
  17.     return func(num/10)+(help(num)*(num%10));
  18. }
  19.  
  20. void main()
  21. {
  22.     int num = 54321;
  23.     printf("%d\n",func(num));
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement