Tech Talk 1
import java.util.Scanner;
public class BinaryAdding {
private static Scanner scanner;
public static void main(String[] args) {
scanner = new Scanner(System.in);
System.out.println("Enter first and second numbers");
String b1 = scanner.nextLine();
System.out.println(b1);
String b2 = scanner.nextLine();
System.out.println(b2);
int num1 = Integer.parseInt(b1, 2);
int num2 = Integer.parseInt(b2, 2);
int output = num1 + num2;
System.out.print("\nThe Sum = ");
System.out.print(Integer.toBinaryString(output));
}
}
BinaryAdding.main(null);