Solved programming problem

How to Add and Subtract in Java

Source code

package addsubtrac;

public class Addsubstract

{

public static void main(String[] args)

{

int a=10;

int b=5;

int add = a + b;

int sub= a-b;

System.out.println("Addition: "+add);

System.out.println("Subtraction: "+sub);

}

}

Output

Addition: 15

Subtraction: 5

Join the discussion

Add your comment