Advertisement
xopsuei

lines

Oct 7th, 2012
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.18 KB | None | 0 0
  1. int sum_digits(int n){ return n == 0 ? 0 : n%10 + sum_digits(n/10);}
  2. bool is_multiple_3(int n){ return n < 10 ? (n == 3) or (n == 6) or (n == 9) : is_multiple_3(sum_digits(n));}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement