package Mobile.OperatorsAndExpressions;
import java.util.Scanner;
public class BitwiseOperators
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a,b;
System.out.println("Enter First Number");
a=sc.nextInt();
System.out.println("Enter Second Number");
b=sc.nextInt();
System.out.println("Bitwise AND (a&b)-->"+(a&b));
System.out.println("Bitwise OR (a|b)-->"+(a|b));
System.out.println("Bitwise XOR (a^b)-->"+(a^b));
System.out.println("Bitwise Left shift by 2 (a<<2)-->"+(a<<2));
System.out.println("Bitwise Right shift by 2 (b>>2)-->"+(b>>2));
}
}
import java.util.Scanner;
public class BitwiseOperators
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a,b;
System.out.println("Enter First Number");
a=sc.nextInt();
System.out.println("Enter Second Number");
b=sc.nextInt();
System.out.println("Bitwise AND (a&b)-->"+(a&b));
System.out.println("Bitwise OR (a|b)-->"+(a|b));
System.out.println("Bitwise XOR (a^b)-->"+(a^b));
System.out.println("Bitwise Left shift by 2 (a<<2)-->"+(a<<2));
System.out.println("Bitwise Right shift by 2 (b>>2)-->"+(b>>2));
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.