Write a JAVA program to find the area and perimeter of a square and rectangle. Store side in s , length as ‘ln’ and breadth as ‘b’. display the results in separate lines. DO NOT USE ANY INPUT METHOD About the author Kinsley
Answer: NOTE – You have said don’t use any input method then I am talking random values. import static java.lang.System.out; public class Geometry { public static void main() { int l = 5 , b = 5; int s = 6; out.print(“Area of Rect”+(l*b)); out.print(“Perimeter of Rect”+(2*(l*b))); out.print(“Area of Square”+(s*s)); out.print(“Perimeter of Square “+(4*s)); } } Reply
Answer:
NOTE – You have said don’t use any input method then I am talking random values.
import static java.lang.System.out;
public class Geometry
{
public static void main() {
int l = 5 , b = 5;
int s = 6;
out.print(“Area of Rect”+(l*b));
out.print(“Perimeter of Rect”+(2*(l*b)));
out.print(“Area of Square”+(s*s));
out.print(“Perimeter of Square “+(4*s));
}
}