You are on page 1of 1

#Name:Montederamos Joanna-Laboratory 2

#Date Created:24/03/2023
#Problem set no. 4
#In a notepad, write a pseudocode that will ask the user for a diameter (in meters)
and will display the volume V = 4/3 πr³ and the surface area 4πr2 of the sphere.

START
SET diameter=0
SET volume=0
SET surface_area=0
SET radius=0
SET pi=3.141592653589793238

INPUT diameter
IF diameter<0
COMPUTE radius=diameter/2
COMPUTE volume=(4/3) * pi * (radius^3)
COMPUTE surface_area=4 * pi * (radius^2)

DISPLAY "The volume of the of the sphere is: "+volume+" cubic meters."
DISPLAY "The surface area of the sphere is: "+surface_area+" square meters"
ELSE
DISPLAY "Invalid input. Diameter must be greater than 0."
END

You might also like