Computer Science, asked by Bhagya1998, 7 months ago

add two integers and print sum in java program​

Answers

Answered by Anonymous
0

hope it will help you!!

Attachments:
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