Advertisement
vov44k

Untitled

Mar 13th, 2022
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class test {
  4.     static int s = 0;
  5.  
  6.     public static void f(int n) {
  7.         if (n > 0) {
  8.             if ((n % 10) % 2 == 0) {
  9.                 s++;
  10.             }
  11.             f(n / 2);
  12.         }
  13.     }
  14.  
  15.     public static void main(String[] args) {
  16.         Scanner in = new Scanner(System.in);
  17.         int n = in.nextInt();
  18.         f(n);
  19.         System.out.print(s);
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement