Swaping of two number without using third variable in Java
Answers
Answered by
3
hey friend!!
i'll tell u how to swap two numbers without using third variable in java,
class swap
{
public void accept (int a,int b)
{
a= a+b;
b=a-b;
a=a-b;
system.out.println("the swapped value of a is" +a)
system.out.println("the swapped value of b is" +b)
}
}
Hope it helps!!
plz mark it a brainlist answer
i'll tell u how to swap two numbers without using third variable in java,
class swap
{
public void accept (int a,int b)
{
a= a+b;
b=a-b;
a=a-b;
system.out.println("the swapped value of a is" +a)
system.out.println("the swapped value of b is" +b)
}
}
Hope it helps!!
plz mark it a brainlist answer
Similar questions
Physics,
7 months ago
Science,
7 months ago
Math,
7 months ago
Social Sciences,
1 year ago
English,
1 year ago