add two integers and print sum in java program
Answers
Answered by
0
hope it will help you!!
Attachments:
Answered by
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
Math,
3 months ago
Political Science,
3 months ago
English,
7 months ago
Math,
7 months ago
Environmental Sciences,
11 months ago
Math,
11 months ago