Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import static java.lang.StrictMath.sqrt;
- public class Main {
- public static boolean RectCircle (int a, int b, int rad) {
- if (Math.hypot(a,b) <= rad*2) { //Math.hypot - вычисление гипотенузы из двух данных катетов
- return true;
- } else {
- return false;
- }
- }
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Введите радиус окружности: ");
- int rad = sc.nextInt();
- System.out.println("Введите первую сторону прямоугольника: ");
- int a = sc.nextInt();
- System.out.println("Введите вторую сторону прямоугольника: ");
- int b = sc.nextInt();
- if (RectCircle(a,b,rad)) {
- System.out.println("Прямоугольник войдет в окружность.");
- } else {
- System.out.println("Прямоугольник не войдет в окружность.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment