Subtracting two Numbers in Java
Subtracting two numbers in java is a simple task. Subtracting two variables in java follows the fundamental subtraction rule of mathematics. First, you have to declare Integer variables (Like n1 & n2). After declaring the variable then you have to assign a value.
For getting the output you have to follow the same procedure as mention in the below code.
Code
public static void main (String args[]){int n1 = 5;int n2 = 4;int n = n1-n2;System.out.println(n);}}
Output
1
0 Comments