Computer Science, asked by priyanshi2116, 11 months ago

write a Java program accept two numbers find out sum of two numbers and print the result​

Answers

Answered by amayra19
9

Answer:

class sum

{

public static void main (String args [])

{

int,a,b,s;

s=a+b;

System.out.println(Sum of two numbers ="+s)

{

{

Answered by atrs7391
0

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