Westonci.ca is the premier destination for reliable answers to your questions, provided by a community of experts. Discover in-depth solutions to your questions from a wide range of experts on our user-friendly Q&A platform. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.
Sagot :
Answer:
* Program to find diameter, circumference and area of circle.
*/
import java.util.Scanner;
public class Circle {
public static void main(String[] args) {
// Declare constant for PI
final double PI = 3.141592653;
Scanner in = new Scanner(System.in);
/* Input radius of circle from user. */
System.out.println("Please enter radius of the circle : ");
int r = in.nextInt();
/* Calculate diameter, circumference and area. */
int d = 2 * r;
double circumference = 2 * PI * r;
double area = PI * r * r;
/* Print diameter, circumference and area of circle. */
System.out.println("Diameter of circle is : " + d);
System.out.println("Circumference of circle is : " + circumference);
System.out.println("Area of circle is : " + area);
}
}
Thanks for stopping by. We are committed to providing the best answers for all your questions. See you again soon. We hope you found this helpful. Feel free to come back anytime for more accurate answers and updated information. Thank you for trusting Westonci.ca. Don't forget to revisit us for more accurate and insightful answers.