Computer Science, asked by shail9748633579, 6 months ago

Wap to calculate the sum of two numbers how to do java​

Answers

Answered by Antaradj
0

Answer:

Java program to add two numbers, a user enters two integers, and we calculate their sum and display it. Using int data type, we can add numbers up to a limit (range of int data type). If you want to add very large numbers, then you may use BigInteger class.

Explanation:

make me a brain list

Answered by atrs7391
0

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