Geometric Calculation
The program calculates the magnitude of a displacement vector in two dimensions.
What is printed when the following Java program is compiled and run?
public class QuestionTrace {
public static void main(String[] args) {
double dx = -3.0;
double dy = 4.0;
double val = Math.sqrt(Math.pow(Math.abs(dx), 2) + Math.pow(Math.abs(dy), 2));
System.out.print((int) val);
}
}
A
5
B
7
C
25
D
12
Question Leaderboard
Not enough data yet to show leaderboard.
