0

I need help, I cant bring out the value of the letters "W, X, Y, and Z" on the last part.

import java.util.Scanner; public class qq { public qq() { } public static void main(String[]args) { int W,X,Y,Z,V; System.out.println("Value before swap:"); Scanner in=new Scanner(System.in); System.out.print("W:"); W=in.nextInt(); System.out.print("X:"); X=in.nextInt(); System.out.print("Y:"); Y=in.nextInt(); System.out.print("Z:"); Z=in.nextInt(); V=W; W=X; X=Y; Y=Z; Z=W; System.out.println("Value after swap: "+W+X+Y+Z); } }

29th Sep 2020, 8:29 AM
Khryss Patrick Estrada
Khryss Patrick Estrada - avatar
3 Réponses
+ 1
Last assignment should be Z=V;
29th Sep 2020, 8:42 AM
Avinesh
Avinesh - avatar
0
What are you trying to achieve? Except for error in line z=w (should be z=v), your code works as expected: reads a bunch of integers and swaps them.
29th Sep 2020, 8:43 AM
Aleksandrs
Aleksandrs - avatar
0
See this code : https://code.sololearn.com/cMJL5qyqyJnp/?ref=app Hope I solved what U are looking for. 😊😊😊
29th Sep 2020, 9:06 AM
AMAN GUPTA
AMAN GUPTA - avatar