Compute area of circle
public class circlearea
{
public static void main(String arg[])
{
double radius;
double area;
radius=20;
area=radius*radius*3.14;
System.out.println("Area of circle having radius 20 is "+area); //here + is use to concatenate //string and variable.
}
}
{
public static void main(String arg[])
{
double radius;
double area;
radius=20;
area=radius*radius*3.14;
System.out.println("Area of circle having radius 20 is "+area); //here + is use to concatenate //string and variable.
}
}
Output: -