//To swap 2 numbers
import java.util.*;
class Prog
{
public static void main(String args[ ])
{
Scanner ob =new Scanner (System.in);
System.out.print("Enter the numbers:");
int x=ob.nextInt( ) ;
int y=ob.nextInt( ) ;
System.out.println("Before Swapping value of First variable :"+x);
System.out.println("Before Swapping value of Second variable :"+y);
y=y+x - (x=y);
System.out.println("After Swapping value of First variable :"+x);
System.out.println("After Swapping value of Second variable :"+y);
}
}
import java.util.*;
class Prog
{
public static void main(String args[ ])
{
Scanner ob =new Scanner (System.in);
System.out.print("Enter the numbers:");
int x=ob.nextInt( ) ;
int y=ob.nextInt( ) ;
System.out.println("Before Swapping value of First variable :"+x);
System.out.println("Before Swapping value of Second variable :"+y);
y=y+x - (x=y);
System.out.println("After Swapping value of First variable :"+x);
System.out.println("After Swapping value of Second variable :"+y);
}
}
Hello sir. I think I am first to comment. I am Priyanshu Ghosh of class 6. Awesome sir and very helpful.
ReplyDeleteSir got the logic clearly :)
ReplyDeleteSir,it was quite helpful. Can you please post the program to input two different dates and display the total days between the two
ReplyDeleteThank you sir ☺
ReplyDeleteThank you, sir
ReplyDeleteI am Bidisha Biswas of class 8A
Thank u ,sir
ReplyDeleteI am Sonia ghosh of class 8A
thanks for it sir
ReplyDeletei needed it really
sir i am bodhisattwa sarkar of class 8 a
ReplyDeletethanks for the program
SIR CAN YOU PLEASE EXPRESS THE FORMAT OF THE DATE COUNT
ReplyDeleteThank u sir, it was vry helpful!!!
ReplyDeleteBARNAK GHOSH CLASS 8 C