Saturday 19 February 2011

Decimal to binary conversion in java


Java code to convert decimal number into binary number 





import java.io.*;




class Test {

    public static void main(String[] args) throws IOException {

    long n,m,no=0l,a=1,rem;

    System.out.println("Enter the decimal number");

    BufferedReader br=new BufferedReader(new InputStreamReader (System.in));

    n=Integer.parseInt(br.readLine());

    m=n;

    while(n!=0){

No comments:

Post a Comment