Solução Esfera

—

por

Solução por Lucas Maekawa  comentário de João Guilherme.

É um problema bastante simples, basta substituirmos os valores na fórmula dada pela questão.

Segue código para melhor entendimento.

#include <cstdio>
#include <cmath>
#define PI 3.14159
using namespace std;
int main() {
int r;
double vol;
scanf("%d", &r);
vol = 4.0/3 * PI * pow(r, 3);
printf("VOLUME = %.3f\n", vol);
return 0;
}
view raw esfera.cpp hosted with ❤ by GitHub

Comentários

Comente