Java Program to Add Two Integers

by anupmaurya
442 views

Program to take two number as input, printing their sum as output.

public class AddTwoIntegers { public static void main(String[] args) { int first = 10; int second = 20; System.out.println("Enter two numbers: " + first + " " + second); int sum = first + second; System.out.println("The sum is: " + sum); } }
Code language: JavaScript (javascript)

What You get as Output , After running the program

Enter two numbers: 10 20 The sum is: 30

You may also like