• Archives

  • Taking out the area of circle,rectangle,sphere and triangle

    By admin | February 2, 2008

    Sometimes you want to take out the area of circle,rectangle,sphere and triangle

    Here i will tell you how

     Circle

    function areaOfCircle(radius) { return Math.PI * Math.pow(radius, 2); }

    Rectangle 

    function areaOfRectangle(width, height) { return width * height; }

    Sphere

    function areaOfSphere(radius) { return 4 * Math.PI * (Math.pow(radius, 2)); }

    Triangle 

    function areaOfTriangle(baseWidth, height) { return baseWidth * height / 2; }

    Thanks

    krates

    Topics: Javascript | 1 Comment »

    Related Links: