Area of a circle and Area of rectangle can simply be evaluated using following formula.
Area = pi * r2
where r is radius of circle
Area = l*b where l is length and b is breadth.
File name - Area.java
class Area
{
public static void main(String args[])
{
int Circle_area, Rect_area, l, b, r;
l=10;
b=5;
r=13;
Circle_area=2*r*r;
Rect_area=l*b;
System.out.println("Area of Circle is "+Circle_area);
System.out.println("Area of Rectangle is "+Rect_area);
}
}
Output-
Area of Circle is 338
Area of Rectangle is 50
0 comments: