program to convert binary to decimal(using java)
class binary_decimal
{
public static void main(String args[])
{
int no=1101,b=0,sum=0,i=0;
while(no>0)
{
b=n0%10;
no=no/10;
sum=sum+(int) b* Math.pow(2,i++);
}
System.out.println(sum);
}
}
class binary_decimal
{
public static void main(String args[])
{
int no=1101,b=0,sum=0,i=0;
while(no>0)
{
b=n0%10;
no=no/10;
sum=sum+(int) b* Math.pow(2,i++);
}
System.out.println(sum);
}
}
Very Helpful...
ReplyDelete