Advertisement
dxvmxnd

Untitled

Sep 9th, 2024
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. num1 = 0;
  2. do {
  3. isNotCorrect = false;
  4. System.out.println("Введи число 1");
  5. try{
  6. num1 = Integer.parseInt(scan.nextLine());
  7. } catch(NumberFormatException exception) {
  8. isNotCorrect = true;
  9. }
  10. if ((isNotCorrect) || (num1 < 0)) {
  11. isNotCorrect = true;
  12. System.err.println("Гойда, ошибка");
  13. }
  14. } while (isNotCorrect);
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement