Home Java Program Examples Java Program to Add Two Integers

Java Program to Add Two Integers

by anupmaurya
1 minutes read

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);

What You get as Output , After running the program

Enter two numbers: 10 20
The sum is: 30

You may also like

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.