Write a program to assign two integers 7 and 9 in variable M and N.Interchange these values. Print the integers before and after interchange.
Answers
Answered by
11
import java.io.*;
class Swap_With
{
public static void main(String[] args)
{
int m=7, n=9, t;
System.out.println("before swapping numbers: "+m +" "+ n);
/*swapping */
t = m;
m = n;
n = t;
System.out.println("After swapping: "+m +" " + n);
System.out.println( );
}
}
Similar questions