Circle or Square

Published by Mubashir Hassan in

Given the radius of a circle and the area of a square, return true if the circumference of the circle is greater than the square's perimeter and false if the square's perimeter is greater than the circumference of the circle.

Examples

circleOrSquare(16, 625) ➞ true

circleOrSquare(5, 100) ➞ false

circleOrSquare(8, 144) ➞ true

Notes

  • You can use Pi to 2 decimal places (3.14).
  • Circumference of a circle equals 2 * Pi * radius.
  • To find the perimeter of a square using its area, find the square root of area (to get side length) and multiply that by 4.
Watch a quick demo on how Edabit works.