7.2.. Napisati program zaodredjivanje y po formuli

package zadatak;
import java.util.Scanner;
public class P07211002 {
	public static void main(String[] args)	{
	Scanner input = new Scanner (System.in);

	int a,b,y;
	System.out.print ("Dva broja ");
	a = input.nextInt();
	b= input.nextInt();
	if (a % 2 != 0)
		y = a + b;
	else 
		y = a - b;
	System.out.println ("a = " + a + " b = " + b + " y = " +y);
	}
}

Ispis na ekranu:

Index