Answer:
import java.util.Scanner;
public class num4 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("First number:");
int fnum = in.nextInt();
System.out.println("Second number:");
int snum = in.nextInt();
System.out.println("Third number:");
int tnum = in.nextInt();
//Call method subtractTwoNumbers
System.out.println("Subtracting the second and third num from the first yeilds" +
" "+subtractTwoNumbers(fnum,snum,tnum));
}
public static int subtractTwoNumbers(int fnum, int snum, int tnum){
int sub = fnum-(snum+tnum);
return sub;
}
}
Step-by-step explanation:
- Java is used to solve this problem
- Use Scanner class to receive three values and stored them in variables as fnum, snum and tnum for first number, second number and third number respectively
- Create the method subtractTwoNumbers() that subtracts the sum of snum and tnum from fnum and returns the value
- In the main method call subtractTwoNumbers() and pass the three numbers as arguments