7.2.. Za učitane a i b izračunati z prema formuli:

Opis programa: Prvo treba naći minimum brojeva a i b ( min = a; IF a>b THEN min = b;), pa maksimum brojeva a i b (max = SQR(a); IF max < SQR(b) THEN max = SQR(b);) te izračunati z (IF max <> 0 THEN z = min / max;).

Listing programa:

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

		System.out.print("Unesi a: ");
		double a=input.nextDouble();
		System.out.print("Unesi b: ");
		double b=input.nextDouble();
		double min,max2;
		min=a;
		max2=(Math.pow(a, 2));
		
		if (b<min) min=b;
		if ((b*b)>max2) max2=(b*b);
		
		System.out.print("min/max2=" +(min/max2));
	}
}

Ispis na ekranu:

Index