Write a Java program to add two integers

//Java program that adds two numbers:
import java.util.Scanner;
public class codingwithsankar {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.print("Enter your first number: ");
//take input from user
int first_number = scanner.nextInt();

System.out.print("Enter the your second number: ");
//take input from user
int second_number = scanner.nextInt();

//addition of two numbers int sum = first_number + second_number;

System.out.println("The sum of " + first_number + " and " + second_number + " is: " + sum);

scanner.close();
}
}

Comments