Didart

Add and Subtract

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