How to calculate the surface area of cylinder in TypeScript

1 Answer

0 votes
const radius : number = 6;
const height : number = 19;
  
const cylinder_surface_area1 : number = (2 * Math.PI * radius * height) + (2 * Math.PI * (radius * radius));
  
const cylinder_surface_area2 : number = 2 * Math.PI * radius * (radius + height);
  
console.log("Cylinder Surface Area = " + cylinder_surface_area1);
console.log("Cylinder Surface Area = " + cylinder_surface_area2);

  
  
  
  
/*
run:
  
"Cylinder Surface Area = 942.4777960769379"
"Cylinder Surface Area = 942.4777960769379"
  
*/

 



answered Nov 15, 2022 by avibootz

Related questions

1 answer 221 views
1 answer 220 views
1 answer 299 views
1 answer 250 views
1 answer 500 views
1 answer 272 views
1 answer 261 views
...