Flowchart to swap two numbers without using any other variables
Introduction
Flowchart to swap two numbers without using any other variables. Normally, during a swap operation, we tend to use a temp variable to hold one value. In this tutorial, we will design a flowchart to swap numbers without using a temporary variable.
Sample output
x=32
y=85
After swap
x=85
y=32
—-Run complete. 12 symbols evaluated.—-
Pseudocode
/**
* NAME:www.TestingDocs.com
* DATE:
* FILE:
* COMMENTS:
*/
START
// declare variables
x = 0;
y = 0;
Prompt “Enter x”;
Input x
Prompt “Enter y”;
Input y
Print(“x=” + x);
Print(“y=” + y);
x = (x + y);
y = x – y;
x = x – y;
Print(“After swap”);
Print(“x=” + x);
Print(“y=” + y);
STOP
More Flowchart Examples
https://www.testingdocs.com/raptor-flowchart-examples/
Raptor Tutorial
Raptor Tutorials on this website can be found at:
https://www.testingdocs.com/raptor-a-flowchart-tool/
RAPTOR official website: https://raptor.martincarlisle.com/