Write a program in java to find area and circumference of a circle when
radius is 12 cm. Also write the variable list.
(Area =ner? circumference=21tr use n=3.14]
Answers
Answered by
6
Corrected Question:-
- Write a program in java to find area and circumference of a circle when radius is 12 cm. Also write the variable list.
Answer:-
//Java Program to calculate area and perimeter of a circle
package Programmer;
public class AreaCircle{
public static void main (String ar []){
int radius=12;
double n=3.14;
double area= n*Math.pow(radius,2); //Or you can write n*radius*radius
double Circumference= 2*n*radius;
System.out.println("Area="+area);
System.out.println("Circumference="+Circumference);
}
}
__
Variable Description:-
- radius:- to store radius 12 cm in it.
- area:- To calculate and store the area of the circle
- n:- to store value of pi()
- Circumference:- to calculate and store the Circumference of the circle.
____
•Output Attached.
____
Attachments:
Answered by
7
Answer:
import java.util.Scanner;
class Area
{
public static void main ( )
{
Scanner sc = new Scanner (System.in);
Double a , c ; int r ,
System.out.println("Enter the Radius ");
r= sc.nextInt();
a = 22/7 * r*r ;
c = 2*22/7 * r ;
System.out.println ( "Area of circle "+a) ;
System.out.println ("Circumference"+c);
}
}
c : store circumference
r : store Radius
a : store area
Similar questions