개발자 뺚

[Cody] Problem 44943. Calculate Amount of Cake Frosting 본문

Solution/MATLAB

[Cody] Problem 44943. Calculate Amount of Cake Frosting

2023. 8. 22. 22:00

Given two input variables r and h, which stand for the radius and height of a cake, calculate the surface area of the cake you need to put frosting on (all around the sides and the top).

Return the result in output variable SA.


function SA = func_frosting(r,h)

  SA = pi * r ^ 2 + 2 * pi * r * h;
    
end