import java.io.*;
class decimal_binary
{
static void convert()throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Please enter a number: ");
        int n=Integer.parseInt(br.readLine());
        String s="";
        for(;n>0;)
            {
                int q=n%2;
                s=Integer.toString(q)+s;
                n/=2;
            }
            System.out.println(s);
        }
    }
1
Contributor
0
Replies
5
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.