Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.laba1_1;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- boolean isCorrect = false;
- int iRad = 0;
- int iSquare = 0;
- System.out.println("Тема: Пройдет ли круг в квадрат?");
- do {
- System.out.println("Введите радиус круга от 1 до 150 ");
- if (in.hasNextInt()) {
- iRad = in.nextInt();
- isCorrect = true;
- } else {
- in.nextLine();
- System.out.println("Введите реальное значение");
- }
- }
- while (!isCorrect);
- isCorrect = false;
- do {
- System.out.println("Введите сторону квадрата от 1 до 150 ");
- if (in.hasNextInt()) {
- iSquare = in.nextInt();
- isCorrect = true;
- } else {
- in.nextLine();
- System.out.println("Введите реальное значение");
- }
- }
- while (!isCorrect);
- if ((iSquare / 2) > iRad) {
- System.out.println("Проходит");
- }
- else {
- System.out.println("Не проходит");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement