Computer Science, asked by perthdas, 2 months ago

Write a function that interchange and prints the value of two integers A and B without using
any extra variable in php.

Answers

Answered by Rudranil420
1

Answer:

Program to swap two integers A and B without using any third variable.

public class Class

{

static void interchange()

{

int A , B;

A = A + B ;

B = A - B ;

A = A - B ;

System.out.println( " After interchanging :

" + " A = " + A + " , B = " + B ) ;

}

public static void main(String[] args)

{

interchange();

}

}

Answered by rima31saha31
3

Answer:

I hope it will help you!!

Attachments:
Similar questions