Java program to right shift a number

Java program to division a number by 2.
Java example Program for right shift a number

Program:-

import java.util.Scanner;
class group{
public static void main(String arg[]){
int num;
Scanner data = new Scanner(System.in);
System.out.println("Enter a number");
num = data.nextInt();
num=num>>2;
System.out.println("Answer:"+num);
}
}

Output:-

Enter a number
8
Answer:2


Learn Java:-
Java codes

Java Programs:-
List of Java Programs

Leave reply

Add your comments here

Back to Top