013-002-005
Math Class: Math Functions
Easy
Problem Description
Math class: Math Functions
In this problem, you will create a program that accepts an integer, calculates its square using Math.pow() and its square root using Math.sqrt(), and displays the result to standard output.
Learning Objective: Perform math calculations with Math class
You will write a program that reads an integer and computes its square using Math.pow(number, 2) and its square root using Math.sqrt(number). Java's Math class provides static methods for mathematical calculations; in this problem, you will use both pow and sqrt.
Input
Line 1: Number (integer)
Output
Square: [square]
Square root: [square root]
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up