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, int broj_na_cifri) {
- if(broj == 0) {
- if(broj_na_cifri % 2 == 0) {
- return 1;
- }
- else {
- return 0;
- }
- }
- return rek(broj / 10, broj_na_cifri + 1);
- }
- int main(int argc, const char * argv[]) {
- int n;
- scanf("%d", &n);
- printf("%d\n", rek(n, 0));
- 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