write a program in Java
to input number user ( by BufferedReader ) and display its binary eqviulant
Answers
Answered by
4
Answer:
import java.io.*;
public class Binary
{
public static void main(String[] args) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n,r;
String d="";
System.out.print("Enter a number: ");
n = Integer.parseInt(in.readLine());
while(n!=0)
{
r = n%2;
d=Integer.toString(r)+d;
n=n/2;
}
System.out.println("Binary equivalent is: "+d);
}
}
Answered by
0
Search google for the best answer....
Hope the advise helps!!
Plz mark me as the brainliest answer....
Hope the advise helps!!
Plz mark me as the brainliest answer....
Similar questions