Program to calculate area of inner circle which passes through center of outer circle and touches its circumference | Java implementation of the above approach ; Function calculate the area of the inner circle ; the radius cannot be negative ; area of the circle ; Driver Code
class GFG { static double innerCirclearea ( double radius ) { if ( radius < 0 ) { return - 1 ; } double r = radius / 2 ; double Area = ( 3.14 * Math . pow ( r , 2 ) ) ; return Area ; } public static void main ( String arr [ ] ) { double radius = 4 ; System . out . println ( " Area ▁ of ▁ circle ▁ c2 ▁ = ▁ " + innerCirclearea ( radius ) ) ; } }