Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created July 29, 2019 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/1f180f2371d161773652963c3ea41326 to your computer and use it in GitHub Desktop.
Save parzibyte/1f180f2371d161773652963c3ea41326 to your computer and use it in GitHub Desktop.
double volumenDeEsfera(double radio) {
/*
1: Elevar radio al cubo y eso multiplicarlo por PI
M_PI * pow(radio, 3);
2: Al resultado anterior lo multiplicamos por 4
(4 * (M_PI * pow(radio, 3)))
3: Al resultado anterior lo dividimos entre 3
(4 * (M_PI * pow(radio, 3))) / 3
*/
return (4 * (M_PI * pow(radio, 3))) / 3;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment