Java program to print the area of circumference of a circle

Java program to print the area of the circumference of a circle. This Java program will print the Area Circumference of a Circle. The diameter of a circle is the distance around it in geometry. That is, the circumference is equal to the circle’s diameter. Pi times the radius of the circle squared is the area of a circle. The circumference of a circle is the distance around it in geometry. That is, the circumference is equal to the circle’s diameter. The radius of a circle squared is pi 3.14 times the area of the circle.

import java.util.Scanner;
public class Main
{
public static void main(String args[])
{
float r;
double area, circumstances;
Scanner scan = new Scanner(System.in);
System.out.print("Enter Radius of Circle ");
r = scan.nextFloat();
area = 3.14*r*r;
circumstances = 2*3.14*r;
System.out.print("Area of Circle = " +area);
System.out.print("\ncircumstance of Circle = " +circumstances);
}
}

 

Output:

Enter Radius of Circle 5

Area of Circle = 78.5

circumstance of Circle = 31.400000000000002

What is float value in java

The float keyword in Java refers to a primitive data type. It’s a 32-bit IEEE 754 floating-point with single precision. It’s where variables and methods are declared. It is used to represent fractional numbers.

Difference between float and double value in java

Both the Double and the Float are used to represent decimal numbers, albeit in slightly different ways. When you multiply pi by 1000, both Double and Float sacrifice some precision after the comma. This means that Float has just four decimal places, but Double has twelve.

How to calculate the area of circumference of circle in java

It’s as simple as this: C = d. The circumference of the circle is represented by “C,” and the diameter is represented by “d.” That is, multiplying the diameter by pi will give you the circumference of a circle.