How to Calculate Circle Perimeter in Java


In this example, you’ll learn how to calculate Perimeter of circle with it’s radius.

Source Code

package com.beginner.examples;

public class CirclePerimeterExample {

    public static void main(String[] args){
    	
    	int r = 10;
    	//return perimeter of a circle.
    	double perimeter = 2 * Math.PI * r ;
		
		System.out.println("Perimeter of a circle is " + perimeter);
    }
}

Output:

Perimeter of a circle is 62.83185307179586
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments