To calculate Area of Circle in java program


To calculate Area of Circle in java program

Area of Circle in java

The following Java program to print the area of a circle has been written in five simple different ways, static method, using constructor, Interface, inheritance with sample outputs for each program.

Source Code

import java.io.*;
import java.util.*;
class Area
{
public static void main(String []args)
{
Scanner ob=new Scanner(System.in);
int l,h,r;
System.out.println(“enter value l,h,r”);
r=ob.nextInt();
int c=(double)3.14*r*r;
System.out.println(“area of circle:”+c);

}
}

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

Domain & free Hosting

Categories

You have successfully subscribed to myprogrammingschool

There was an error while trying to send your request. Please try again.

My Programming School will use the information you provide on this form to be in touch with you and to provide updates and marketing.