Views: 202
Following program shows you how to calculate circle circumference.
In this program we get circle radius from user and calculate circumference using following formulaCircumference = 2 X PI X r
import java.util.Scanner;
public class MathGeometry9 {
public static void main(String[] args) {
double circleRadius;
Scanner in = new Scanner(System.in);
System.out.println("Please enter the radius of circle:");
circleRadius = in.nextDouble();
double circumferenceOfCircle = 2 * Math.PI * circleRadius;
System.out.println("Circumference of circle is: " + circumferenceOfCircle);
}
}
Output:
Please enter the radius of circle:
4
Circumference of circle is: 25.132741228718345
On By
Navya
Top Tutorials
492.5K
32K
21.8K
18.7K
18.7K
6.7K
6.7K
4.9K
3.3K
3.2K
Top Questions
18.7K
14.5K
8.3K
6.6K
6.2K
5.7K
4.8K
4.8K
4.3K
3.9K
Top Articles
1.9K
1.6K
947
Top Blogs
796
779
55
Top News
754
686
670
398
385
385