## sebassn -1

Please, can someone help me in this exercise, because I really don't know too much about swaping!...I dont need to write the whole code, only a part of it when it's shown how I swap and round them...

_____

Write the code that swaps the value of two int variables. Then round both variables to the nearest tenth. example: (If x contains the value of 43 and y the value of 87, then after the swap, the x should contain the value 87, and y the value 43. After rounding, x should contain a value of 90, and y the value of 40. )

i got this, im not sure at all!...

``````firstValue As Integer
secondValue As Integer

firstValue = 43
secondValue = 87

firstValue = firstValue ^ secondValue
secondValue = firstValue ^ secondValue
firstValue = firstValue ^ secondValue``````

## Grn Xtrm 84

To swap you need to three int values.
Let a= 1st number
Let b = 2nd number
Let t = temp holder
To swap you need to set t equal to the first number (a)
then set the first number equal to the second (b)
Finally set the second number equal to the temp value.
This way a becomes b AND b becomes a.

## sebassn -1

Ok, thanks
I'll just try to write it down and try to code it and I'll post it hereto see if it's correct!

## sebassn -1

``````int a=17;
int b=24;
int t;
t == a;
a == b;
b == t;``````

It's just like that?

## Grn Xtrm 84

``````int a=17;
int b=24;
int t;
t == a;
a == b;
b == t;``````

It's just like that?

Well that's the right idea, but you only need to use one = sign.
You are assigning (=) not comparing (==).
Good work!

## necrolin 94

You do realize that == compares two values whereas = assigns a value. Therefore, it's...

t = a;
a = b;
b = t;

## sebassn -1

Ohh i see, yeah, I got confused with the equal sign and the assignment operator. Thank you!