Saturday, July 27, 2013

java Program to Calculate Area and Circumference of Circle

Program to Calculate Area and Circumference of Circle

import java.lang.*;
import java.io.*;
class crcl
{
public static void main(String a[])
{
try
{
DataInputStream dts=new DataInputStream(System.in) ;
System.out.println("enter radius of circle");
float m = Float.parseFloat(dts. readLine());
double area, cir;
area = 3.14 * m * m;
cir = 2 * 3.14 * m;
System.out.println("area of circle =" + area);
System.out.println("circumfrance of circle =" +cir);
}
catch(Exception x)
{
System.out.println(x.getMessage());
}
}
}
Output:

No comments:

Post a Comment