answersLogoWhite

0


Best Answer

There are three primary algorithms to exchange the values of two variables.

Exchange with Temporary Variable

temp = a;

a = b;

b = temp;

Exchange Without Temporary Variable Using Exclusive Or

a = a ^ b;

b = b ^ a;

a = a ^ b;

Exchange Without Temporary Variable Using Arithmetic

a = a + b;

b = b - a;

a = a - b;

User Avatar

Wiki User

βˆ™ 14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

βˆ™ 11y ago

write a program in c swap two number without using tempry vriable with flochart and algorithum

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the Algorithm for exchanging values of two variables?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write C coding for swamping the values of two variables without using a third variable?

I'll assume you meant to say: Swapping instead of Swamping. You would need to perform the XorSwap algorithm: void XorSwap(int *x, int *y) { if(x != y) { *x ^= *y; *y ^= *x; *x ^= *y; } } You can read more about this algorithm on Wikipedia.


A Write the algorithm to concatenate two given strings?

a write the algorithm to concatenate two given string


Write a program that defines a template function named add This function takes two arguments add two variables and then return the sum?

Write a program that defines a template function named add(). This function takes two arguments, add two variables and then return the sum. In main function, define two variables of type int, two variables of type float and two objects of type 'String'. Now call the add() function three times for these different data types. Note: String is a user-defined data type and for this you have to define a class named 'String'. When template function will be called to add two objects of type String then it must concatenate two strings. Your output should look like this: Sample Output: Enter two integer values to be added Enter First value: 12 Enter Second value: 25 Enter two float values to be added Enter First value: 13.5 Enter Second value: 14.2 Enter two Strings to be added Enter First value: Virtual Enter Second value: University Addition of two variables of different data types Sum of values of type int = 37 Sum of values of type float = 27.7 Sum of values of type String = VirtualUniversity


What difference between two nodes in c plus plus of single link list?

Their address. They may also have different values, and their sequence may matter, depending on the design of the algorithm.


Program designed to swap the values of two variables?

You'll need 3 variables for this, here's a pseudo code for swapping values of 2 variables.ALGORITHM SWAPvar1 = 10var2 = 20temp = 0temp = var1 "temp = 10"var1 = var2 "var1 = 20, originally 10"var2 = temp "var2 = 10, originally 20"END SWAP

Related questions

Can continuous variables assume a limited number of values between any 2 specific values?

Yes, if you have two limiting variables with other possibles variables between them, the variables between the limiting variables would be continuous.


What is shown on a line graph?

The values for two variables plotted on two axes


A definition of a solution to a system of equations?

A system of equations is a set of two or more equations with the same variables, graphed in the same coordinate plane


What are the values that are used in a function?

There are several possibilities. They can be called arguments and there are two kinds, variables and constants. Variables can have different values and constants are always the same.


When an equation has two variables there is a number of values that the two variables could have?

If an equation has two variables, we'll call them (x,y), the variables can be any value as long as both sides of the equation have the same result. If the equation was x = y, then the variables could be (1,1), (2,2), (3,3),etc...


If two variables are negatively associated then above-average values of one tend to accompany?

Below-average values of the other.


Write C coding for swamping the values of two variables without using a third variable?

I'll assume you meant to say: Swapping instead of Swamping. You would need to perform the XorSwap algorithm: void XorSwap(int *x, int *y) { if(x != y) { *x ^= *y; *y ^= *x; *x ^= *y; } } You can read more about this algorithm on Wikipedia.


How do I create and inequality using absolute values with two variables?

x>|7| + |8|


How do you find covariance of two variables?

The covariance between two variables is simply the average product of the values of two variables that have been expressed as deviations from their respective means. ------------------------------------------------------------------------------------------------- A worked example may be referenced at: http://math.info/Statistics/Covariance


Write an algorithm to swap the values of two variables?

x=9; y=4; x=x+y; #x=13;y=4; y=x-y; #y=13-4=9; x=x-y; #x=13-9=4;


What are the variables in this equation 3ab plus c over 2?

The variables of this equation are your letters: a, b, and c. Variables merely stand in an equation to represent values that we don't know. "Solving" an equation is the process by which we uncover those values. In this particular case, since there are three variables, we cannot discover their values unless we have two other equivalent equations (a system of equations).


What is a scatterplot?

A scatter plot is also known as a scatter diagram. It is a graph in which the values of two variables are plotted along two axes.