import java.util.Scanner;
public class BinarytoDecimal {
public static void main(String[] args) {
Scanner myScanner=new Scanner(System.in);
System.out.print("Enter a binary number : ");
while (myScanner.hasNextInt()) {
String binary=myScanner.nextLine();
System.out.println("Decimal value is : "+Integer.parseInt(binary,2));
System.out.print("Enter a Binary number : ");
}
}
}
public class BinarytoDecimal {
public static void main(String[] args) {
Scanner myScanner=new Scanner(System.in);
System.out.print("Enter a binary number : ");
while (myScanner.hasNextInt()) {
String binary=myScanner.nextLine();
System.out.println("Decimal value is : "+Integer.parseInt(binary,2));
System.out.print("Enter a Binary number : ");
}
}
}
No comments:
Post a Comment