Write a function in Java called factorial()
that will take a positive integer as input and returns its factorial as output.
Search Results
Searching for: math
Individual Exercises
Given an integer representing the radius of a sphere, compute and return the sphere's volume based on the following formula:
Volume = 4/3...
The circuit()
method is intended to take the distance a person has moved on a circuit (a track) and translate it into the position they...
Write a function in Java that takes the int array arr
and returns a new array with each number being doubled. Be sure to make use of...
In mathematics, the Perrin Numbers are defined by the recursion relation
P(n) = P(n - 2) + P(n -3) for n > 2
with initial values
P(0)...
This method returns the value of the minimum element in the subsection of the array "y", starting at position "first" and ending at...
Write a function in C++ called factorial()
that will take a positive integer as input and returns its factorial as output.
Write a recursive function called add_digits
that will receive a positive number and returns the sum of each of digits. For example,...
Write a recursive function called half_left
that will receive a measurement of the amount of a chemical that is decaying. The amount will...
Given an integer representing the radius of a sphere, compute and return the sphere's volume based on the following formula:
Volume = 4/3...
Write a function in Java that calculates a total cost with tax and tip. Given three doubles: basePrice, taxRate (as a decimal, e.g., 0.08...
Write a function in Java that calculates what grade a student needs on the next quiz to reach a target average. Given three ints:...
Write a function in Java that calculates the average speed of a trip. Given four ints: distance (miles), days, hours, and minutes;
...
Write a function in Java that calculates the difference between the volumes of two cubes. Given two doubles: sideLength1 and sideLength2...
Complete this method to return the sum of the two parameters.
Create a print line that sums variable a and variable b.
create a print line that will cast integer division m as an double.
Complete this method so it prints out the remainder of the two parameters.
Complete this method so it prints out the quotient of the two parameters.
Complete this method so it prints out the product of the two parameters.
Complete this method so it prints out the difference between the two parameters.