Sun. Oct 17th, 2021

TECHTUNES WORLD

# Write Java Code and Run Online Java Compiler.

Code, Compile, Run and Debug java program online.

Write your code in this editor and press “Run” button to execute it.

Sample Solution:

Write a Java program to print the area and perimeter of a circle.

In geometry, the area enclosed by a circle of radius r is πr2. Here the Greek letter π represents a constant, approximately equal to 3.14159, which is equal to the ratio of the circumference of any circle to its diameter.

The circumference of a circle is the linear distance around its edge.

Pictorial Presentation:

Why is the area of a circle of a circle pi times the square of the radius?

Java Code:

``````import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner io = new Scanner(System.in);
System.out.println("Input the radius of the circle: ");
System.out.println("Perimeter is = " + (2 * radius * Math.PI));
}
}
``````

Output:

`Input the radius of the circle:   5 Perimeter is = 31.41592653589793 Area is = 78.53981633974483 `

Flowchart:

#### You may have missed 10 min read

#### Children’s groupis excellent 6 min read

#### congenital heart disease 6 min read

#### Scandinavians in Minnesota 6 min read