Dremendo Tag Line

Print sum and product of 2 numbers in Java

Java Output - Question 9

In this question, we will see how to print the sum and product of 2 integer numbers in java programming using the java output. To know more about java output click on the java output lesson.

Q9) Write a program in java to find the sum and product of 2 integer numbers like int a=5 and b=3.

Program

public class Q9
{
    public static void main(String args[])
    {
        int a=5,b=3;
        System.out.println("Sum=" + (a+b));
        System.out.println("Product=" + (a*b));
    }
}

Output

Sum=8
Product=15
video-poster