Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- import java.util.Scanner;
- public class SimpleAdd {
- public static void main(String[] args)
- {
- Scanner in = new Scanner (System.in);
- char num1, num2;
- System.out.println("Enter two digits between 0 and 9:");
- num1 = in.next().charAt(0);
- num2 = in.next().charAt(0);
- int n1 = num1 - '0';
- int n2 = num2 - '0';
- System.out.printf("Your equation is: %d + %d = %d", n1, n2, n1+n2);
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment