write a program to input radius of circle and print its circumference and area
Answers
Answer:
import java.util.Scanner;
public class circle
{
public static void main(String args[])
{
System.out.println("Area and circumference of circle calculator :)");
Scanner in = new Scanner(System.in);
double r, c, a;
System.out.println("Input the radius of circle :)");
r=in.nextInt();
c=2*3.14*r;
a=3.14*r*r;
System.out.println("The area of circle is :"+a);
System.out.println("The circumference of circle is :"+c);
}
}
Question
write a program to take the input the radius of a circle and print area and circumference.
Asked
A program to find and print area and circumference.
Answer Starts
- Valuable Description
Data type Variables Descriptions
double radius To except the
value of Radius.
double area To except the
value of Area.
double circumference To except the
value of
circumference.
Program Starts
import java.util.Scanner;
class CircleDemo
{
public static void main(string args[ ])
{
Scanner sc = new Scanner (System.in);
System.out.println("enter the radius:");
double radius = sc.nextDouble ( );
double area = Math.PI * ( radius * radius );
System.out.println("area of the circle is:" +area );
double circumference = Math.PI * 2 * radius;
System.out.println("circumference of the circle is:" +circumference);
}
}
Program Completed
Kindly Refer to above Attachments :)
hope it helps :)
keep learning!
be brainly!