Advertisement
H_I

Class 6, task 1

H_I
Dec 28th, 2024
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int checkEvenDigit(int num);
  4.  
  5. int main()
  6. {
  7.     int num, result;
  8.     printf("please enter a number:\n");
  9.     scanf("%d", &num);
  10.    
  11.     result = checkEvenDigit(num);
  12.     printf("result is %d", result);
  13.    
  14.    
  15. }
  16.  
  17. int checkEvenDigit(int num)
  18. {
  19.     if (num == 0)
  20.     {
  21.         return 0;
  22.     }
  23.     if((num%10)%2 == 0)
  24.     {
  25.         return 1;
  26.     }
  27.    
  28.     return checkEvenDigit(num/10);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement