Computer Science, asked by hardhik68, 7 months ago

Q4.Write a program to input the dimensions of a rectangle and find the area of
that square whose perimeter is equal to the perimeter of the rectangle.​

Answers

Answered by ksroopa2015
0

Answer:

Please specify the programming language

Answered by duragpalsingh
1

Question

Write a program to input the dimensions of a rectangle and find the area of that square whose perimeter is equal to the perimeter of the rectangle.

Solution:

import java.util.*;

public class Question

{

static void main()

{

Scanner sc=new Scanner(System.in);

float l,b,p,s,a;

System.out.println("Enter the length & breadth of the rectangle:");

l=sc.nextFloat();

b=sc.nextFloat();

p=2*(l+b); //perimeter of the rectangle

s=p/4; /*side of the square whose perimeter is equal

to the perimeter of the rectangle*/

a=s*s; //area of the square

System.out.println("Area of the Square:"+a);

}

}

Learn More on Brainly:

Write a program to print sum of Fibonacci series upto fifth term.

https://brainly.in/question/9009750

Write a program to input 5 integers and find the average.

https://brainly.in/question/29286707

Similar questions