Math, asked by Kiyulnn, 1 year ago

a Java program to generate the area of circle

Answers

Answered by Anonymous
4
Heya.....❤️❤️

★ ★ ★ ★ ★ ★ ★ ★

class AreaofCircle{
   public static void main()
   {
     {
     int r = 7;
     int Area = 22/7 * 7 * 7;
     System.out.println("Area of circle = " + Area);

     }
     }
   }

        Output

Area of circle = 154

____________________________________________________________________________________

Java is a predifined computer specialized coding.

Java follows some rules in the programs.






newyork05ananya: This program is totally wrong. I am a beginner to java and i have done it.
Anonymous: we need to input radius and then apply the formula .... is n't it ?
Anonymous: it is not wrong you have done copying mistake
Anonymous: what is copying mistake ? O_o
Answered by Anonymous
5

CODE


import java.util.*;

class area

{

public static void main ( String args [] )

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter the radius");

int r=sc.nextInt();

double pi=3.14;

double area = pi*r*r;

System.out.println("Area of circle ="+area);

}

}

}


The program first takes the radius as input.

Then we print the area using the formula of circle.

Similar questions