Java Program to find area of Circle (Use Constant)

Description

Get radius of circle and find area of circle.
Input 1:
4
Output1:
50.24

Solution

import java.util.*;
class Circle
{
 
    public static void main(String args[])
    {
 
        double radius;
        double area;
        Scanner sc=new Scanner(System.in);
        System.out.println("Get the radius of Circle and find area of Circle");
        System.out.println("Enter The Input 1:");
        radius=sc.nextDouble();
        area=3.14*radius*radius;
        System.out.println("The Output 1 Is:\n"+area);

    }

}

We are Teaching "Web Development using Python" through Online.

View Tutor Profile and Course Syllabus

Explanation

Get radius of a circle (using scanner class)

Calculate area by  multiplying pi and radius and radius (area =pi*radius*radius)
 (pi is  3.14 , global constant)

Print area (using system.out.println)
Ramesh P Natarajan

Author - Ramesh P Natarajan

Software Developer and Technology Trainer, very much passionate in the field of Software Application Development, Machine Learning and Search Engine Optimization.

Write to: [email protected]





Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********Solution