Thursday, June 4, 2020

Write a program in java to input two number and Swap the Numbers (interchange the value) using third variable.

2)  Write a program in java to input two number and Swap the Numbers (interchange the value) using third variable.

public class Swaping_using_third_var
{
    public static void main(int a, int b)
    {
        System.out.println("a = "+a);
        System.out.println("b = "+b);
        int p = a;
        a = b;
        b = p;
        System.out.println();
        System.out.println("a = "+a);
        System.out.println("b = "+b);
    }
}

No comments:

Post a Comment

if you have any doubts, Please let me know.
Your Truly
Shashank Porwal

 jhvghvgk ;nkjn ,nkjhj