Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P05_AddAndSubtract {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. int num1 = Integer.parseInt(scanner.nextLine());
  7. int num2 = Integer.parseInt(scanner.nextLine());
  8. int num3 = Integer.parseInt(scanner.nextLine());
  9. int sum1_2 = getSum(num1, num2);
  10. System.out.println(subtract(sum1_2, num3));
  11.  
  12. }
  13. static int getSum(int num1, int num2) {
  14.  
  15. return num1 + num2;
  16. }
  17.  
  18. static int subtract(int sum, int num3) {
  19. return sum - num3;
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement