Answers for "Calculate the area and perimeter of the circle java"

1

Java program to calculate area of a circle

import java.util.Scanner;
public class CalculateAreaOfCircle
{
   public static void main(String[] args)
   {
      double radius;
      double pi = 3.1415, area;
      Scanner sc = new Scanner(System.in);
      System.out.println("Please enter radius of circle: ");
      radius = sc.nextDouble();
      area = pi * radius * radius;
      System.out.println("Area of circle: " + area);
      sc.close();
   }
}
Posted by: Guest on November-10-2020
0

Java Program to find the perimeter of the circle

@Test
	public void findPerimeterOfTheCircleProgram12() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("Enter the RADIUS of the Circle: ");
		double radius = scanner.nextDouble();
		scanner.close();
		// Logic for printing the PERIMETER of the circle
		System.out.println("Perimeter of the Circle having radius " + radius + (2 * Math.PI * radius));
	}
Posted by: Guest on November-11-2020

Code answers related to "Calculate the area and perimeter of the circle java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language