What is the final value of [tex]$x$[/tex] after performing the following operations?

[tex]\[
\begin{array}{l}
\text{int } x = 21; \\
\text{double } y = 6; \\
\text{double } z = 14; \\
y = x / z; \\
x = 5.5 * y;
\end{array}
\][/tex]

A. 5.5
B. 5
C. 8.25
D. 8



Answer :

Let's solve this step-by-step to find the final value of [tex]\( x \)[/tex].

1. Initial Values:
[tex]\[ x = 21, \quad y = 6.0, \quad z = 14.0 \][/tex]

2. First Operation:
[tex]\[ y = \frac{x}{z} \][/tex]
Substituting the values:
[tex]\[ y = \frac{21}{14.0} = 1.5 \][/tex]

3. Second Operation:
[tex]\[ x = 5.5 \cdot y \][/tex]
Substituting the newly calculated value of [tex]\( y \)[/tex]:
[tex]\[ x = 5.5 \cdot 1.5 = 8.25 \][/tex]

After performing these operations, the final value of [tex]\( x \)[/tex] is [tex]\( 8.25 \)[/tex]. Therefore, the correct answer is [tex]\( 8.25 \)[/tex].