Computer Science, asked by salmankhanbjnr, 11 months ago

How can i Add two number without any operator in java???

Answers

Answered by ayush12452
0

Answer:

it is not possible to add two or more numbers without using an operator. so no.

Answered by atrs7391
0

Yes, it is not possible with Math.addExact() function.

Your Program:

package com.company;

import java.util.Scanner;

class test

{

   public static void main(String[] args)

   {

       Scanner sc = new Scanner(System.in);

       System.out.println("Enter first number: ");

       long n1 = sc.nextLong();

       System.out.println("Enter second number: ");

       long n2 = sc.nextLong();

       System.out.println("The sum of the numbers: "+Math.addExact(n1,n2));

   }

}

Similar questions