Answers for "Java program to calculate area of circle using method"

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
1

area of circle in java

import java.util.Scanner;
public class AreaOfCircle {
   public static void main(String args[]){
      int radius;
      double area;
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter the radius of the circle ::");
      radius = sc.nextInt();
      area = (radius*radius)*Math.PI;
      System.out.println("Area of the circle is ::"+area);
   }
}
Posted by: Guest on September-02-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 "Java program to calculate area of circle using method"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language