1.0.2 • Published 5 months ago
sodiqlist v1.0.2
Area Calculator
This package provides functions to calculate the area of a circle and the area of a square.
Installation
You can install this package using npm:
npm install area-calculator
Usage
Calculate the Area of a Circle
To calculate the area of a circle, use the calculateCircleArea
function. You need to provide the radius of the circle.
const { calculateCircleArea } = require('area-calculator');
const radius = 5;
const areaOfCircle = calculateCircleArea(radius);
console.log(`The area of the circle is ${areaOfCircle}`);
Calculate the Area of a Square
To calculate the area of a square, use the calculateSquareArea
function. You need to provide the side length of the square.
const { calculateSquareArea } = require('area-calculator');
const sideLength = 4;
const areaOfSquare = calculateSquareArea(sideLength);
console.log(`The area of the square is ${areaOfSquare}`);
Functions
calculateCircleArea(radius)
- Parameters:
radius
(number): The radius of the circle.
- Returns:
- The area of the circle.
calculateSquareArea(sideLength)
- Parameters:
sideLength
(number): The side length of the square.
- Returns:
- The area of the square.
License
This project is licensed under the MIT License.