write a program in Java to calculate area and perimeter of a rectangle
Answers
Answered by
7
hope it helps you. ....
Attachments:
yaehya:
I am asking to write in Java
Answered by
3
Program :- [JAVA]
public class Rectangle
{
public static void main(String args [ ] )
{
int length = 3, width = 4;
int area;
System.out.println(''Length is : '' + length);
System.out.println(''Width is : '' + width);
System.out.println(''Area is : '' + (length * width));
System.out.println(''Perimeter is : '' + (2 * (length + width)));
}
}
Output :-
Length is : 3
Width is : 4
Area is : 12
Perimeter is : 14
Similar questions