binary to decimal conversion

Binary to Decimal Number Program in Java

import java.util.Scanner; /** * * @author AFAQ */ public class BinaryToDecimal { public static void main(String[] args) { int binary; Scanner sc = new Scanner(System.in); System.out.print(“Enter binary number=”); binary = sc.nextInt(); int decimal = 0; int n = 0; while (binary>0) { int temp = binary % 10; decimal += temp * Math.pow(2, n); binary […]