Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ex9f
- {
- public static void main(String[] args)
- {
- Scanner input = new Scanner(System.in);
- System.out.print("**** Calculate x = y2 - y - 2 ****\n\nPlease enter a value for Y:\t");
- int num = input.nextInt();
- System.out.print(num + " squared - ( " + num + " - 2 ) equals " + (squared(num) - subtract(num)));
- }
- public static int squared(int a)
- {
- return a * a;
- }
- public static int subtract(int a)
- {
- return a - 2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement