sergAccount

Untitled

Oct 4th, 2020
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.17 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package appdz2;
  7.  
  8. public class AppDz2 {
  9.     /*
  10.     Задача 1
  11.     Создать новый проект
  12.     Создать метод, который выводит на экран
  13.     все числа от n до m, кроме чисел которые меньше 0.
  14.     У метода должно быть два параметра типа int: n и m.
  15.     Вызвать данный метод в методе main
  16.     */
  17.     // printNumbers
  18.     public static void printNumbers(int n, int m){
  19.         //
  20.         for(int i=n; i<=m; i++){
  21.             if(i>=0){
  22.                 System.out.println(i);
  23.             }
  24.         }
  25.     }
  26.     //
  27.     public static void main(String[] args) {
  28.         // TODO code application logic here
  29.         // вызов метода          
  30.         printNumbers(-10, 10);
  31.        
  32.         // проверка задачи 2
  33.         double res = MathUtil.areaOfCircle(10, 3.14);
  34.         System.out.println(res);
  35.     }    
  36. }
  37.  
Add Comment
Please, Sign In to add comment