Skip to content

Commit

Permalink
Merge pull request #7 from KaveeshYoshitha/main
Browse files Browse the repository at this point in the history
CircleAreaCalculator Added
  • Loading branch information
Ayu-hack authored Oct 1, 2024
2 parents 5820fe0 + 2ba506f commit de637a6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions CircleAreaCalculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import java.util.Scanner;

public class CircleAreaCalculator {

public static double calculateArea(double radius) {
return Math.PI * radius * radius;
}

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.print("Enter the radius of the circle: ");
double radius = scanner.nextDouble();

double area = calculateArea(radius);

System.out.println("The area of the circle with radius " + radius + " is: " + area);

scanner.close();
}
}

0 comments on commit de637a6

Please sign in to comment.