# Calculate Circle Perimeter Using Java Example

by Dinesh Thakur Category: Data Type

In the Following example PerimeterofCircleExample shows how to Calculate Perimeter of Circle using 2*pi*r. where r is a radius of a circle.

```import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader; public class PerimeterofCircleExample { // Declaring class name as PerimeterofCircleExample public static void main(String[] args) {                int r = 0;  // r for radius of circleSystem.out.print("Please enter the radius value r :");try{

//Obtaining the keyboard input with BufferedReaderBufferedReader Buffer= new BufferedReader(new InputStreamReader(System.in)); r = Integer.parseInt(Buffer.readLine());/* Math.PI = 3.14 is Math constant to get value of pi    Perform Calculations and Display Result    calculate the perimeter of circle that is PerimeterofCircle = 2 *pi*r*/

double PerimeterofCircle = 2 * Math.PI * r;System.out.println("The Perimeter of circle is " + PerimeterofCircle);}catch(Exception e)                     {                                 System.out.println("Input Error : "+e);                                              }         }}
```  Dinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles