Custom Search

Saturday, 25 August 2012

Java Program to find Radius of a circle, Write a java Program that finds a radius using this variable


Java Program to find Radius of a circle, Write a java Program that finds a radius using this variable


Program
class radius
{
double pie,area,r;
radious(double p,double a)
{
this.pie=p;
this.area=a;
}
void calculate()
{
r=(area/(2*pie));
System.out.println("Radius of circle is: "+r);
}
}
class Test
{
public static void main(String args[])
{
radius rd=new radius(3.14,22.24);
rd.calculate();
}
}

No comments:

Post a Comment

Laptops