28.9k views
2 votes
Consider the following code segment.

num += num;

num *= num;

Assume that num has been previously declared and initialized to contain an integer value. Which of the following best describes the behavior of the code segment?



A: The value of num is two times its original value.



B:The value of num is the square its original value.



C:The value of num is two times the square of its original value.



D:The value of num is the square of twice its original value.



E:It cannot be determined without knowing the initial value of num.

User Ursa Major
by
5.5k points

1 Answer

6 votes

Answer:

D

Step-by-step explanation:

(n+n)(n+n)

(2n)^2

4n^2

User Erik James Robles
by
5.8k points