7.2.. Za učitane a i b izračunati z prema izrazu z = min(a2, b2).
Opis programa:
Listing programa:
package zadatak;
import java.util.Scanner;
public class P07211043 {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.println ("Manji kvadrat");
double a,b,min;
System.out.print("Dva broja ");
a = input.nextDouble();
b = input.nextDouble();
min = (a*a); // min = Math.pow(a, 2)
if ((b*b) < min)
min = (b*b); // min = Math.pow(b, 2)
System.out.println("a = " + a + " b = " + b + " min = " + min);
}}
Ispis na ekranu:
Index
|
|