Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Program1
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ public class SwapNumbers {
float first = 1.20f, second = 2.45f;

System.out.println("--Before swap--");
System.out.print("First number = " + first)
System.out.println("First number = " + first);
System.out.println("Second number = " + second);

// Value of first is assigned to temporary
float temporary = first;

// Value of second is assigned to first
first = second
first = second;

// Value of temporary (which contains the initial value of first) is assigned to second
second += temporary;
second = temporary;

System.out.println("--After swap--");
System.out.println("First number = " + first);
Expand Down