Tech Study

Addition Program in Java : Print Sum, Multiply, Subtract, Divide Of Two Numbers

Addition Program in Java Programming Language

You will find the code of Addition program in Java or Sum of two numbers in Java programming language. The program i have wirtten below is the common for Sum of numbers in Java, Multiplication of two numbers in Java, Subtractions of two numbers in Java adn Division of two number in Java. But I have also provided a saperate program of Addition Program of Two Number in Java.

In this demo I have used NetBeans IDE 8.2 for debugging purpose. But you can use any java programming language compiler as per your availability..

import java.util.Scanner;
public class Javaexcercise {
 public static void main(String[] args) {
  Scanner in = new Scanner(;
  System.out.print("Input 1st number: ");
  int num1 = in.nextInt();
  System.out.print("Input 2nd number: ");
  int num2 = in.nextInt();
  System.out.println("Addition of two numbers: " + num1 + " + " + num2 + " = " + 
  (num1 + num2));
  System.out.println("subtraction of two numbers: " +num1 + " - " + num2 + " = " + 
  (num1 - num2));
  System.out.println("Multiplication of two numbers: "+ num1 + " x " + num2 + " = " + 
  (num1 * num2));
  System.out.println("Division of two numbers: " + num1 + " / " + num2 + " = " + 
  (num1 / num2));
  System.out.println("Remainder of two numbers: "+ num1 + " mod " + num2 + " = " + 
  (num1 % num2));
Write a Java program to print the sum, multiply, subtract, divide and remainder of two numbers
Write a Java program to print the sum, multiply, subtract, divide and remainder of two numbers

Addtion Program in Java | Sum of Two Numbers in Java | Sum of n Numbers in Java

This is the program for Addition of Two Numbers in Java. I have used method and command-line arguments in this one. You just need to declare and initialize two variable which will be added. Another variable to store the sum of numbers.

public class SumOfNumbers1  
public static void main(String args[])   
int n1 = 150, n2 = 105, sum;  
sum = n1 + n2;  
System.out.println("The sum of numbers is: "+sum);  


The sum of numbers is: 265

Write a Java program to print the odd numbers from 1 to 20

Java Program to Calculate & Print Average of 5 Numbers

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more