Revision: 68159
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 4, 2014 07:24 by Tharix
Initial Code
#Code by Tharix @ Snipplr #Importing modules import math print("Circle/Sphere calculator") print("Note: Pi is equal to",math.pi) #Getting the radius as input r = int(input("Radius: ")) #Calculations based of the radius d = r*2 #_circle is the calculation, where pi is also calculated PCirclePi = math.pi*r*2 SCirclePi = math.pi*r**2 #_npi is the calculation, where pi (as a symbol) is left in PCircleNPi = r*2 SCircleNPi = r**2 #Sphere area SSpherePi = 4*math.pi*(r**2) SSphereNPi = 4*(r**2) #Sphere volume VSpherePi = 4/3*math.pi*(r**3) VSphereNPi = (r**3) #Output print(" ") #Diameter print("d =",d) #Circle perimeter print("P =","pi*{}".format(PCircleNPi),"or",PCirclePi) #Circle area print("Scircle =","pi*{}".format(SCircleNPi),"or",SCirclePi) #Sphere area print("Ssphere =","4*pi*{}".format(SSphereNPi)+"*{}".format(SCircleNPi),"or",SSpherePi) #Sphere volume print("Vsphere =","4/3*pi*{}".format(VSphereNPi),"or",VSpherePi)
Initial URL
Initial Description
A simple program to calculate the area and perimeter of a circle and to calculate the area and volume of a sphere. Source is commented,
Initial Title
Circle and sphere calculator
Initial Tags
math
Initial Language
Python