Question: Write a JavaScript program to perform the following tasks: Compute the volume of a cylinder using the following pseudocode. We can hard code the value
Write a JavaScript program to perform the following tasks:
Compute the volume of a cylinder using the following pseudocode. We can hard code the value for the radius in this assignment. Later, we will learn how to accept input from a console. You can choose a few random values for the radius variable and test and validate your program's correctness.
declare variable radius and assign a value of 5 to the radius
declare a constant PI and assign a value of 3.14 to the PI constant (using keyword constant)
area = radius * radius * PI volume = area * length
print the result to the console using console.log()
console.log(volume);
(Please keep the code as simple as possible, this is only our first assignment)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
