- Home
- Course
- Arithmetic operators
- Calculate dimensions of sphere

Monday, November 13, 2023
⁃
Difficulty:
Easy

Create a program in Java for calculate the surface and volume of a sphere, given its radius.

- surface= 4 * pi * radius squared
- volume= 4 / 3 * pi * radius cubed

- Request the sphere's radius from the user.
- Calculate the surface area of the sphere using the formula.
- Calculate the volume of the sphere using the formula.
- Display the results of the surface area and volume on separate lines.

60

Surface: 45238,934 Volume: 678584,06

Share it on your social media and challenge your friends to solve programming problems. Together, we can learn and grow.

The code has been successfully copied to the clipboard.

Continue improving your Java programming skills with our selection of practical exercises from the lesson. Click on Practice and challenge your knowledge!

Practice with easy and intermediate Java exercises on arithmetic operations and some types of numerical data.