From d27dc78ff7c5920fcccf59b92c85a48632ed8d6c Mon Sep 17 00:00:00 2001
From: Ayush Tiwari <92630471+Ayu-hack@users.noreply.github.com>
Date: Thu, 3 Oct 2024 00:20:34 +0530
Subject: [PATCH] Swap Two Numbers

---
 Swap Two Numbers | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Swap Two Numbers

diff --git a/Swap Two Numbers b/Swap Two Numbers
new file mode 100644
index 0000000..ff675de
--- /dev/null
+++ b/Swap Two Numbers	
@@ -0,0 +1,24 @@
+public class SwapNumbers {
+
+    public static void main(String[] args) {
+
+        float first = 1.20f, second = 2.45f;
+
+        System.out.println("--Before swap--");
+        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;
+
+        // Value of temporary (which contains the initial value of first) is assigned to second
+        second = temporary;
+
+        System.out.println("--After swap--");
+        System.out.println("First number = " + first);
+        System.out.println("Second number = " + second);
+    }
+}