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 minimum kvadrata brojeva a i b ( min2 = SQR(a); IF SQR(b) < min2 THEN min2 = SQR(b);) te izračunati z.
Listing programa:
package zadatak;
import java.util.Scanner;
public class P07211051 {
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,min2;
min=a;
min2=(Math.pow(a, 2));
if (b<min) min=b;
if ((b*b)<min2) min2=(b*b);
System.out.print("min/(min2+6)=" +(min/(min2+6)));
}
}
Ispis na ekranu:
Index
|