vstoyanov

Оператори и Изрази 11.1

May 13th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. import org.omg.CORBA.MARSHAL;
  2. import org.omg.Messaging.SYNC_WITH_TRANSPORT;
  3.  
  4. import java.lang.reflect.Array;
  5. import java.util.Scanner;
  6.  
  7. public class Main {
  8.  
  9.     public static void main(String[] args) {
  10.         Scanner scanner=new Scanner (System.in);
  11.  
  12.         int n=Integer.parseInt(scanner.nextLine());
  13.  
  14.  
  15.  
  16.  
  17.         int p=Integer.parseInt(scanner.nextLine());
  18.  
  19.  
  20.  
  21.         int mask=1<<p;
  22.  
  23.         if((mask&n)!=0){
  24.             System.out.println(1);
  25.         }else {
  26.             System.out.println(0);
  27.         }
  28.  
  29.  
  30.  
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment