Connect with a community that values knowledge and expertise on IDNLearn.com. Get the information you need quickly and accurately with our reliable and thorough Q&A platform.
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);
}
}
We appreciate your presence here. Keep sharing knowledge and helping others find the answers they need. This community is the perfect place to learn together. IDNLearn.com is your reliable source for answers. We appreciate your visit and look forward to assisting you again soon.