swapping program does not use third variable

Answer Posted / venkanna

swap(a,b);
{
a=a+b;
b=a-b;
a=a-b;
}
Explenation:
if a=5 and b=10
a=a+b(5+10)=15
b=a-b(15-10)=5------------swaped here
a=a-b(15-5)=10------------

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is abstraction needed?

567


What is pure oop?

599


What is an advantage of polymorphism?

597


What is the real time example of encapsulation?

598


Templates mean

1589






What is oops and why we use oops?

573


What is the main feature of oop?

620


Where is pseudocode used?

565


What is polymorphism in oops with example?

533


How does polymorphism work?

635


What is methods in oop?

543


What is protected in oop?

604


What is difference between inheritance and polymorphism?

573


What is a class oop?

594


What are oops methods?

568