Java Program to Find Area of Inner Circle which Passes through Center of Outer Circle and Touches its Circumference

In the previous article, we have discussed about Java Program to Find Angle on Circumference Subtended by the Chord When the Central Angle Subtended by the Chord is Given

In this article we are going to see how to find area of inner circle which passes through center of outer circle and touches its circumference by using Java programming language.

Java Program to Find Area of Inner Circle which Passes through Center of Outer Circle and Touches its Circumference

Before Jumping into the program directly let’s see how to find Area of inner circle which passes through center of outer circle and touches its circumference

Suppose there is 2 circles C1 and C2

Where C1 is having radius R1

Let circle C1 > circle C2 Means C1 is outer circle and C2 is inner circle.

Now C2 passes through center of circle C1 and touch the circumference of circle C1.

So now, we need to find the area of the circle C2
Since C2 passes the center of C1 and the circumference of C1

So we can say, diameter of C2 = radius of C1

So radius of circle C2 = R1/2

Now area of circle C2 = pi*( R1/2)*( R1/2)

Example:

R = 20  //outer circle radius
r = 20/2 = 10 //got inner circle radius
Area of circle C2 = 3.14 * 10 * 10 = 314

Let’s see different ways to find area of inner circle which passes through center of outer circle and touches its circumference

Method-1: Java Program to Find Area of Inner Circle which Passes through Center of Outer Circle and Touches its Circumference By Using Static Input Value

Approach:

  • Declare an double variable say ‘R’ and assign the value to it, which holds the radius of the circle C1.
  • Find the radius of circle C2 using the formula R/2
  • Find the area of the circle using the formula pi * (R/2) * (R/2)
  • Print the result.

Program:

import java.io.*;
class Main
{
    public static void main(String [] args)
    {
        double R = 20;
        // formula to find radius of the circle C2
        double r =  R/2;     
        // formula to find area of the circle C2
        double Ar = 3.14 * r * r;
        System.out.println("The area of the circle C2 is " + Ar);
    }
}
Output:

The area of the circle C2 is 314.0

Method-2: Java Program to Find Area of Inner Circle which Passes through Center of Outer Circle and Touches its Circumference By Using User Input Value

Approach:

  • Declare an double variable say ‘R’ and take the value as user input, it is the radius value of the circle C1.
  • Find the radius of circle C2 using the formula R/2
  • Find the area of the circle using the formula pi * (R/2) * (R/2)
  • Print the result.

Program:

import java.io.*;
import java.util.Scanner;
class Main
{
    public static void main(String [] args)
    {
         // scanner class obj ref 
        Scanner s = new Scanner(System.in);                              
        System.out.println("Enter the radius of the circle C1");
         // to take user input value of outer circle radius
        double R = s.nextDouble();                                           
        // formula to find radius of the circle C2 i.e. inner circle
        double r =  R/2;     
        // formula to find area of the circle C2
        double Ar = 3.14 * r * r;
        System.out.println("The area of the circle C2 is " + Ar);
    }
}

Output:

Enter the radius of the circle C1
20
The area of the circle C2 is 314.0

Are you wondering how to seek help from subject matter experts and learn the Java language? Go with these Basic Java Programming Examples and try to code all of them on your own then check with the exact code provided by expert programmers.

Related Java Programs: