xxxxxxxxxx
#define _USE_MATH_DEFINES // must include this!
#include <cmath>
return 4/3 * M_PI * r*r*r;
Volume of a sphere in javascript
xxxxxxxxxx
function volumeOfSphere(redius){
return ( 4 / 3 ) * Math.PI *(redius**3);
}
const result = volumeOfSphere(5);
console.log(result);