- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise10.java
More file actions
Latest commit
16 lines (13 loc) · 607 Bytes
/
Copy pathExercise10.java
File metadata and controls
16 lines (13 loc) · 607 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
publicclassExercise10 {
publicstaticvoidmain(Stringarg[]) {
// Write a program that can "swap" two variables. In other words,
// the value originally in x should end up in y, and the original
// value of y should end up in x.
System.out.print("Enter two numbers (with a space between them): ");
intx = StdIn.readInt();
inty = StdIn.readInt();
System.out.println("At first, x is " + x + " and y is " + y);
// Add your code here, then click "run" to test it.
System.out.println("At the end, x is " + x + " and y is " + y);
}
}