Computer Science, asked by yuvi2697, 11 months ago

W.A.P to radius and perimeter of circle in javascript.

Answers

Answered by gurukulamdivya
1

Answer:

function circle(radius)

{

   this.radius = radius;

 // area method

   this.area = function ()  

   {

       return Math.PI * this.radius * this.radius;

   };

 // perimeter method

   this.perimeter = function ()

   {

       return 2*Math.PI*this.radius;

   };

}

var c = new circle(3);

console.log('Area =', c.area().toFixed(2));

console.log('perimeter =', c.perimeter().toFixed(2));

Similar questions