Advertisement
Spocoman

08. Circle Area and Perimeter

Aug 20th, 2024
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CircleAreaAndPerimeter {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double r = Double.parseDouble(scanner.nextLine());
  7.         double area = Math.PI * r * r;
  8.         double perimeter = 2 * Math.PI * r;
  9.  
  10.         System.out.printf("%.2f\n%.2f", area, perimeter);
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement