Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- int rek(int broj) {
- if(broj == 0) {
- return 0;
- }
- return rek(broj / 10) + 1;
- }
- int main(int argc, const char * argv[]) {
- int n;
- scanf("%d", &n);
- if(rek(n) % 2 == 0) {
- printf("1\n");
- }
- else {
- printf("0\n");
- }
- return 0;
- }
- /*
- rek(12345, 0) = rek(1234, 1) = 0
- rek(1234, 1) = rek(123, 2) = 0
- rek(123, 2) = rek(12, 3) = 0
- rek(12, 3) = rek(1, 4) = 0
- rek(1, 4) = rek(0, 5) = 0
- rek(0, 5) = 0
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement