Computer Science, asked by prasadshreya3851, 2 months ago

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 BrainlyProgrammer
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.
  • \sf \: area =  n {r}^{2} \\  \sf circumference = 2n r \\  \sf \: use \: n = 3.14

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:-

  1. radius:- to store radius 12 cm in it.
  2. area:- To calculate and store the area of the circle
  3. n:- to store value of pi( \pi)

  1. Circumference:- to calculate and store the Circumference of the circle.

____

•Output Attached.

____

Attachments:
Answered by abhishekpatel59259
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