Binary to decimal
import java . util .* ; public class practice { public static void main ( String [] args ) { Scanner s = new Scanner ( System . in ); int n , b = 0 , k , i = 0 ; System . out . println ( "Enter the binary Number to be converted to Decimal" ); n = s . nextInt (); while ( n > 0 ){ k = n % 10 ; b = b + k * ( int ) Math . pow ( 2 , i ); n = n / 10 ; i ++; } System . out . println ( "binary vlaue of Decimal Number is " + b ); } }