70.2k views
2 votes
Write a program that reads in the radius of a sphere and computes the surface area and volume of the sphere using the following formulas: A = 4*3.14r 2 V = 4/3 x 3.14r 3

Enter the radius of the sphere: 2.5 [Enter]

The surface area of the sphere is 78.53982

The volume of the sphere is 65.44985

User Georgiann
by
7.4k points

1 Answer

3 votes

Answer:

// program in Python.

#library

import math

#read the radius of sphere

rad=float(input("Enter the radius of sphere:"))

# find the Surface area

A=4*math.pi*rad**2

V=(4/3)*math.pi*rad**3

#print the Surface area

print("The surface area of the sphere is:",A)

#print the Volume of sphere

print("The volume of the sphere is:",V)

Step-by-step explanation:

Import math library to use the value of "pi".Read the radius of sphere from user and assign it to variable "rad".Then calculate the surface area A = 4*3.14r**2 and volume of sphere V=V = 4/3 x 3.14r**3.Print the surface area and volume of the sphere.

Output:

Enter the radius of sphere:2.5

Surface area is: 78.539812

Volume of sphere is: 65.44985

User Tszming
by
7.6k points