7.2.. Napisati program za izračunavanje vrijednosti z prema izrazu:

Listing programa:

package zadatak;
import java.util.Scanner;
public class P0721106 {
	public static void main(String[] args)	{
	Scanner input = new Scanner (System.in);
 
    System.out.println ("Odredjivanje z po formuli");
    System.out.print("Dva broja: ");
    double a = input.nextInt();
    double b = input.nextInt();
    double z;
    if (a > 1)
    	z = b / a;
    else
    	if ((-6 < a) || (a <= 1)) 
    		z = a + 3;
    	else 
    		z = a + b;
    System.out.println("z = " + z);
}}

Ispis na ekranu:

Index