Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Exc5AddSubtract {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int first = Integer.parseInt(scanner.nextLine());
- int second = Integer.parseInt(scanner.nextLine());
- int third = Integer.parseInt(scanner.nextLine());
- System.out.println(getResult(first, second, third));
- }
- private static int getResult(int first, int second, int third) {
- return ((first+ second)-third);
- }
- }
- //You will receive 3 integers. Write a method sum to get the sum of the first
- // two integers and subtract method that subtracts the third integer
- // from the result from the sum method.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement