Exercise
As a Salesforce Developer
I want to compute the square root of a given number using Apex
So that I can verify mathematical operations and display the result in debug logs for troubleshooting or testing purposes.
Acceptance Criteria:
Input Variable:
The script must define a Decimal variable, num
, with a predefined value.
Example value:
num = 144
Processing Logic:
The script must calculate the square root of the number using the Math.sqrt()
method.
The result must be stored in a variable named result
.
Expected Outcome
The square root of 144 is 12
Code
Decimal num = 144;
Decimal result = Math.sqrt(num);
System.debug('The square root of '+ num + 'is ' + result);
Video
Video does not exists.