Advertisement
Guest User

Untitled

a guest
May 24th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class calc
  5.  
  6. {
  7. public static void main(String args[])
  8. {
  9.  
  10. Scanner kb = new Scanner(System.in);
  11. System.out.println("Enter your first number: ");
  12. double x = kb.nextDouble();
  13.  
  14. System.out.println("Enter your second number: ");
  15. double y = kb.nextDouble();
  16.  
  17. double add = x+y;
  18. double sub = x-y;
  19. double dub= x*y;
  20. double nub = x/y;
  21.  
  22. System.out.println("The result of adding is "+add);
  23. System.out.println("The result of subtracting is "+sub);
  24. System.out.println("The result of multiplying is "+dub);
  25. System.out.println("The result of dividing is "+add);
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement