Answers for "a function that will return the area of a 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

area of circle in java

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        final  float PI = 3.14f;
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter radius of circle: ");
        int radius = scanner.nextInt();

        double areaOfCircle = PI * Math.pow(radius,2);

        System.out.printf(" Area of circle of circle is %.2f ",areaOfCircle);
    }
}
Posted by: Guest on June-23-2021

Code answers related to "a function that will return the area of a circle java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language