Tuesday 23 January 2018

Simple Addition In java

public class addition  {
  public static void main(String[] args) {

  // declare variables
        int x, y, z;

  // Specify values of x and y
        x = 2;
        y = 3;

        z = x + y;

    System.out.println("x has a value of " + x);
    System.out.println("y has a value of " + y);
    System.out.println("The sum of x + y is " + z);

   // System.exit(0);
  }
}


0 comments: