what will b the coding of a program.. "program to swap two no. using third variable"

Recommended Answers

All 9 Replies

tmp = a;
a = b;
b = tmp;
tmp = a;
a = b;
b = tmp;

you posted wrong solution. Can not use temp variable.

you posted wrong solution. Can not use temp variable.

priyairani00> "program to swap two no. using third variable"

priyairani00> "program to swap two no. using third variable"

Maybe I misread the problem -- I thought "no." meant "not", which is why I posted the link I did.

> "program to swap two no. using third variable"
A better question would be:
"How to swap my idiot teacher of 1970's assembler tricks with someone who has a clue about programming in the modern world".

commented: lol +4

/me wonders whether the OP was agreeing or disagreeing.

thank u very much for all ur answers...it seems very helpful!!
actually im a student in c. so dont have deep knowledge abt dis language. trying best to learn it.
thanks for all ur help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.