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); } }
3 Réponses
+ 1
Last assignment should be Z=V;
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.
0
See this code :
https://code.sololearn.com/cMJL5qyqyJnp/?ref=app
Hope I solved what U are looking for.
😊😊😊