Advertisement
Idanref

check why doesn't work with 123

Nov 27th, 2020
1,226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int sumeven(int num)
  4. {
  5.     int counter;
  6.  
  7.     if(num < 10)
  8.         return num;
  9.  
  10.     counter = num % 10;
  11.  
  12.     return ((sumeven(num / 10) + counter) % 2 == 0) ? 1 : 0;
  13. }
  14.  
  15.  
  16. void main()
  17. {
  18.     printf("%d\n", sumeven(879176));
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement