Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- bool is_even(int x){
- printf("\tis_even(%d)\n", x);
- if (x == 0)
- return true;
- else{
- bool tmp = !is_even(x-1);
- return tmp;
- }
- }
- int main(){
- int x;
- printf("Introduce un numero positivo: ");
- scanf("%d", &x);
- if (is_even(x))
- printf("%d es par\n",x);
- else
- printf("%d es impar\n",x);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement