Advertisement
desislava_topuzakova

05. Add and Subtract

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