grodek118

Kolo

Mar 24th, 2022
805
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4. import static java.lang.Math.*;
  5.  
  6. public class Main {
  7.  
  8.     public static void main(String[] args) {
  9.         System.out.println("Podaj r: ");
  10.         Scanner scanner = new Scanner(System.in);
  11.         double r = scanner.nextInt();
  12.         double pole = perimeter(r);
  13.         double obwod = area(r);
  14.         System.out.println(pole);
  15.         System.out.println(obwod);
  16.  
  17.     }
  18.  
  19.     public static double area(double radius) {
  20.  
  21.         return 2 * PI * radius;
  22.     }
  23.  
  24.     public static double perimeter(double perimeter){
  25.  
  26.         return PI * perimeter * perimeter;
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment