Advertisement
Ferix

RSOJava#6

Nov 25th, 2020
654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.lang.Math;
  3.  
  4. public class MyClass {
  5.     public static void main(String args[]) {
  6.        
  7.         Scanner input = new Scanner(System.in);
  8.        
  9.         double area = input.nextDouble();
  10.        
  11.         if(area<=0){
  12.             System.out.println("Area cannot be 0 or lower than 0...");
  13.         } else{
  14.             double radius = Math.sqrt(area/Math.PI);
  15.             System.out.println("Circle radius is "+ radius);
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement