• Java

    Demonstrate concept of Arithmetic & Bitwise Operators with a java program. Operands to be considered as per the operators entered by the user.

    The below program performs arithmetic and bitwise operations based on number entered by user. Scanner class is used to take input from the user, which is inside java.util.ScannerĀ  class. System.in is used to use input classes. Example import java.util.Scanner; class ArithmeticOperation { //arithmetic operation on float data public static void main(String args[]) { int n1,n2; int fChoice; Scanner sc=new Scanner(System.in); System.out.println("Select Choice\n"); System.out.println("1. Arithmetic Operation"); System.out.println("2. Bitwise Operation"); System.out.println("Enter Your Choice"); fChoice=sc.nextInt(); System.out.println("\nEnter First Value"); n1=sc.nextInt(); System.out.println("Enter Second Value"); n2=sc.nextInt(); switch(fChoice) { case 1: ArithmeticOp(n1,n2); break; case 2: BitwiseOp(n1,n2); break; default: System.out.println("Invalid Choice"); break; } } public static void ArithmeticOp(int…