CBSE Class 11 Computer Science Question 36 of 40

Data Handling — Question 18

Back to all questions
18
Question

Question 18

Write a program to calculate the radius of a sphere whose area (4πr2) is given.

Solution
import math

area = float(input("Enter area of sphere: "))

r = math.sqrt(area / (4 * math.pi))

print("Radius of sphere =", r)
Output
Enter area of sphere: 380.14
Radius of sphere = 5.50005273006328
Answer

import
math
area
=
float
(
input
(
"Enter area of sphere: "
))
r
=
math
.
sqrt
(
area
/
(
4
*
math
.
pi
))
print
(
"Radius of sphere ="
,
r
)
Output
Enter area of sphere: 380.14
Radius of sphere = 5.50005273006328