Answers for "subtract two variables in java"

0

subtract two variables in java

public class Subtraction{
  	//simple subtraction method in Java
	public static void main(String args[]){
    	int x = 3; // initializing first variable with a value
      	int y = 1; // initializing second variable
      	
      	int answer = x - y; // new variable which is subtracting two variables x and y
      	
      	System.out.println( x + " - " + y + " = " + answer );
      	// printing the answer of variables on the console
    }
}
Posted by: Guest on October-04-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language