import java.util.*;
class binary
{
public static void main (String arg[])
{
Scanner in=new Scanner (System.in);
int a,d;
System.out.print ("\n\t Enter the number = ");
a=in.nextInt();
int b1,b2,b3,b4,b5,b6,b7,b8;
b1=a%2;
d=a/2;
b2=d%2;
d=d/2;
b3=d%2;
d=d/2;
b4=d%2;
d=d/2;
b5=d%2;
d=d/2;
b6=d%2;
d=d/2;
b7=d%2;
d=d/2;
b8=d%2;
System.out.print ("\n\t Binary of "+a+" is = ");
System.out.print (b8);
System.out.print (b7);
System.out.print (b6);
System.out.print (b5);
System.out.print (b4);
System.out.print (b3);
System.out.print (b2);
System.out.print (b1);
}
}
class binary
{
public static void main (String arg[])
{
Scanner in=new Scanner (System.in);
int a,d;
System.out.print ("\n\t Enter the number = ");
a=in.nextInt();
int b1,b2,b3,b4,b5,b6,b7,b8;
b1=a%2;
d=a/2;
b2=d%2;
d=d/2;
b3=d%2;
d=d/2;
b4=d%2;
d=d/2;
b5=d%2;
d=d/2;
b6=d%2;
d=d/2;
b7=d%2;
d=d/2;
b8=d%2;
System.out.print ("\n\t Binary of "+a+" is = ");
System.out.print (b8);
System.out.print (b7);
System.out.print (b6);
System.out.print (b5);
System.out.print (b4);
System.out.print (b3);
System.out.print (b2);
System.out.print (b1);
}
}
No comments:
Post a Comment