Write algorithm and flowchart for exchanging of two variables
Answers
Answered by
1
Algorithm : a. using a third variable
Step 1 : Start
Start 2 : READ num1, num2
Start 3 : temp = num1
Start 4 : num1 = num2
Start 5 : num2 = temp
Start 6 : PRINT num1, num2
Start 7 : Stop
Algorithm : b. without using a third variable
Step 1 : Start
Start 2 : READ num1, num2
Start 3 : num1 = num1 + num2
Start 4 : num2 = num1 - num2
Start 5 : num1 = num1 - num2
Start 6 : PRINT num1, num2
Start 7 : Stop
Similar questions