Skip to content

Instantly share code, notes, and snippets.

@samueltcsantos
Created May 8, 2014 00:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samueltcsantos/08ac0c88d1c966f65615 to your computer and use it in GitHub Desktop.
Save samueltcsantos/08ac0c88d1c966f65615 to your computer and use it in GitHub Desktop.
Algoritmo para calcular o volume e a área de uma esfera.
# -*- coding:utf-8 -*-
#------------------------------------------
# Autor: Samuel T. C. Santos
# Data: 07/05/2014
# python version-2.x
#------------------------------------------
import math
raio = raw_input("Raio? ")
# V= 4/3*pi*r^3
volume = 4/3 * math.pi * math.pow(float(raio),3)
# A = 4 * pi*r^2
area = 4 * math.pi * math.pow(float(raio),2)
print "Area = %.2f" % area
print "Volume %.2f" % volume
@Andersol2022
Copy link

boa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment