Write a program that inputs two numbers, swaps these values without using third variable and display them.

  public static void main(String[] args) { Scanner n=new Scanner(System.in); int a, b; System.out.println(“Enter 1st Values”); a= n.nextInt(); System.out.println(“Enter 2nd Values”); b=n.nextInt(); a=a+b; b=a-b; a=a-b; System.out.println(“1st value is=”+a); System.out.println(“2nd value …

Read More

Write a program that inputs two numbers. It then calculates and displays the quotient and remainder.

  public static void main(String[] args) { Scanner n=new Scanner(System.in); int a, b,div,rem; System.out.println(“Enter 1st Values”); a= n.nextInt(); System.out.println(“Enter 2nd Values”); b=n.nextInt(); div=a/b; rem=a%b; System.out.println(“quotient is=”+div); System.out.println(“remainder is=”+rem); } } …

Read More