Write a program in JAVA to swap number without using 3rd variable

No comments

import  java.util.*;
class  swaping
{
   public  static  void  main (String obj[])
       {
           int  a , b;
Scanner  sc=new  scanner (system.in);
System.out.println (“Enter  the  value  of a & b”);
a=sc.nextInt ();
b = sc.nextInt ();
a=a+b;
b=a-b;
a=a-b;
system.out.println(“Value  of  a  &  b  is=”+a+”  “+b);
          }
}

No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀