MIT-Curricular/OOP/Java/Lab/Week2/Operators.java

29 lines
720 B
Java
Raw Normal View History

2024-08-05 01:04:41 +05:30
import java.util.Scanner;
public class Operators {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("Enter the value of a:");
int a = sc.nextInt();
System.out.println("Enter the value of b:");
int b = sc.nextInt();
int c = (a<<2) + (b>>2);
System.out.println("Output of (a<<2) + (b>>2) is: "+c);
boolean d = (b > 0);
System.out.println("Output of (b>0) is: "+d);
int e = (a + b * 100) / 10;
System.out.println("Output of ((a + b * 100) / 10) is: "+e);
int f = a & b;
System.out.println("Output of (a & b) is: "+f);
}
}