Algorithm for swapping of two numbers without temp

Subject: PPS (Programming for Problem Solving)

Contributed By: Sanjay

Created At: February 3, 2025

Question:


Write an Algorithm for Swapping of two numbers Without Using Temporary Variable

Explanation Video:

Custom Image

Explanation:

Algorithm:

  1. Start.

  2. Read two numbers, a and b.

  3. Assign a = a + b.

  4. Assign b = a - b.

  5. Assign a = a - b.

  6. Print a and b.

  7. Stop.

Share this Article & Support Us:
Status
printf('Loading...');