Answers for "area of circle formula 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
0

Area of a Circle in Java Programming

import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        double R,A;
        Scanner sc = new Scanner(System.in);
        R = sc.nextDouble();
        A = 3.14159 * R * R;
        System.out.printf("A=%.4f\n",  A);
   }
}
Posted by: Guest on June-28-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language