Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

what will be the output of this code? int x = 13; int y = 3; int a = y;…

Question

what will be the output of this code?
int x = 13;
int y = 3;
int a = y;
y = x;
x = a;
system.out.print(x);

Explanation:

Step1: Initialize variables

$x = 13$, $y = 3$, $a = y = 3$

Step2: Update y with x's value

$y = x = 13$

Step3: Update x with a's value

$x = a = 3$

Step4: Output the final x value

The code prints the current value of $x$.

Answer:

3