Sarvarbek Vaxobov
3-Laboratoriya ishi
Mavzu: Javada operatorlar va ifodalar bilan ishlash
Vazifalar: 26
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter value for p: ");
double p = scanner.nextDouble();
System.out.print("Enter value for a: ");
double a = scanner.nextDouble();
System.out.print("Enter value for b: ");
double b = scanner.nextDouble();
double x = (Math.tan(Math.sqrt(2)) + Math.abs(p)) / 2;
if (x >= a && x <= b) {
System.out.println("The root x = " + x + " belongs to the
interval [" + a + ", " + b + "].");
} else {
System.out.println("The root x = " + x + " does NOT belong to the
interval [" + a + ", " + b + "].");
}
scanner.close();
}
}