answersLogoWhite

0


Best Answer

include

#include

void main()

{

int x, y, temp;

printf("Enter the value of x and y ");

scanf("d", &x, &y);

printf("Before Swapping x = %d\ny = %d\n",x,y);

temp = x;

x = y;

y = temp;

printf("After Swapping x = %d\ny = %d\n",x,y);

getch();

return 0;

}

Do you happen to know what a flow-chart is?

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

To swap two values, A and B:

temp = A

A = B

B = temp

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the flowchart for swapping two variables?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the advantage of swapping two variables without using 3 variable?

Nothing. Never do that.


What is meant by swapping of variables?

It means that you swap the values of that variables EX: -==- before swapping :- Variable1 = 5; variable2 = 10; after swapping :- Variable1 = 10; variable2 = 5;


Why is the interactive Visual Logic flowchart program more useful than a manually drawn flowchart?

A manual flowchart is static. The advantage of an interactive Visual Logic flowchart is that it allows users to input values for various variables at runtime. When the flowchart is finished, users can then run the program behind the chart.


Define flowchart and draw flowchart for GCD of two numbers?

pictorial representation of a program is called a flowchart


Flowchart to add two numbers?

ghjukkghhgyg


What is the Flowchart for multiplication of two matrices?

[object Object]


What is the meaning of 'swapping' in computer architecture?

Swapping means to swap the values of two addresses in main memory.


What is structural flowchart?

it's like a family tree, yourself, then flows to two parents, then flows to their 4 parents, and on and on. in otherwords, a flowchart


What are the two types of flowchart?

low level and high level


How do you write a c program to swap the values of two variables in unix?

#include<stdio.h> void main() { int a=2,b=4; printf("Program for swapping two numbers "); printf("Numbers before swapping"); printf("a=%d and b=%d",a,b); a=((a+b)-(b=a)); printf("Numbers after swapping"); printf("a=%d and b=%d",a,b); getch(); }


Difference between macor flowchart and micro flowchart?

1. Macro flowchart shows less information whereas micro flowchart shows more information. 2. Macro flowchart is easy to design as comparative to micro flowchart. 3. Macro flowchart is difficult to study and understand as comparative to micro flowchart.


Swapping of two variables withou using temp variable?

example: x = x-y; y = y-x; x = y-x; <><><> It is not possible to swap two variables without using a temp variable. The code in the answer above, while clever, does not swap the variables. It will exchange the variable values for certain values of x and y, e.g. when x and y are small integers. If x and y are other values, such as strings, pointers, Infinity, NaN (not a number), floating point, or near the limits of the representation (causing over/underflow) then the code will not "swap" the values. <---> Note: there is absolutely no point in swapping two variables without using temopral variable, it's just a typical homework question, already asked here countless times. Another variation: a ^= b; b ^= a; a ^= b;