Basic Arithmetic Operations in Java

The basic arithmetic operations in Java are: + addition, - subtraction, * multiplication, / division,% module

import java.io.*;

public class Main
{
	public static void main(String[] args) {
	    int number1,number2;
	    int addition, subtraction, multiplication, division, module;
	    number1=2;
	    number2=3;
	    addition=number1+number2;
	    subtraction=number1-number2;
	    multiplication=number1*number2;
	    division=number1/number2;
	    module=number1%number2;
	    System.out.println("number1+number2 ="+addition);
		System.out.println("number1-number2 ="+subtraction);
		System.out.println("number1*number2 ="+multiplication);
		System.out.println("number1/number2 ="+division);
		System.out.println("number1%number2 ="+module);
	}
}

 

output:

number1+number2 =5
number1-number2 =-1
number1*number2 =6
number1/number2 =0
number1%number2 =2

 

Tagged In:

Software developer

26 Total Posts