Професионална програма
Loading...
JimBeaPie avatar JimBeaPie 0 Точки

Проблем със задача Cone. JS-Data-Types-And-Variables

Здравейте имам проблем със следната задача.Качвам условието и кодът ми. Благодаря.

 

  1. Cone

Write a function to calculate a cone’s volume and total surface area by given height and radius at the base.

The input comes as two number arguments. The first element is the cone’s radius and the second is its height.

The output should be printed to the console on a new line for every result. The result should be formatted to the fourth decimal point

Examples

Input

Output

 

Input

Output

3,

5

volume = 47.1239

area = 83.2298

 

3.3,

7.8

volume = 88.9511

area = 122.0159

Hints

You can use this online tool to check your results: http://www.calculatorsoup.com/calculators/geometry-solids/cone.php

 

https://pastebin.com/ifwbqL73

Тагове:
0
Fundamentals Module
Stani82 avatar Stani82 13 Точки

Мерси много за отговора. Действително, даде 100/100 :)

1
diela33 avatar diela33 0 Точки

function solve(r, h) {

 

    let volu = (((Math.PI * r * r) * h) / 3).toFixed(4);

    let str = 'volume'

    console.log(`${str} = ${volu}`);

    let s = Math.sqrt(r * r + h * h);

    let arr =  Math.PI * r * (r + s);

    let str1 = 'area';

    console.log(`${str1} = ${arr.toFixed(4)}`);

 

}

0