Computer Science, asked by supriyamishra23573, 8 months ago

write a program in Java
to input number user ( by BufferedReader ) and display its binary eqviulant

Answers

Answered by dhareaveer
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 ishasadana83
0
Search google for the best answer....
Hope the advise helps!!
Plz mark me as the brainliest answer....
Similar questions
Math, 8 months ago