Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class AddNumbers{
- public static void main(String [] args) {
- //variables
- double x, y, z;
- System.out.println("Enter two numbers to calculate their sum!");
- Scanner in = new Scanner(System.in);
- try {
- System.out.println("First number: ");
- x = in.nextDouble();
- System.out.println("Second number: ");
- y = in.nextDouble();
- z = x + y;
- System.out.println("The sum is = " + z);
- }
- catch (InputMismatchException e) {
- }
- System.out.println("You fucked up, idiot.");
- }
- }
Add Comment
Please, Sign In to add comment