Thursday, December 23, 2021

Addition and Division of Two Numbers in Java

 A simple program that I wrote using Java programming language to ask the user to give two numbers and then the program will compute the sum and division of two numbers and display the results on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing

import java.util.Scanner;


public class Addition_Division {


public static void main(String[] args) {

   int val1=0,val2=0;

   

Scanner input_val= new Scanner(System.in);

  System.out.println("\n");

  System.out.println("\tAddition and Division of Two Numbers in Java");

  System.out.println("\n");

      System.out.print("\tEnter the first number  : ");

      val1=input_val.nextInt();

      System.out.print("\tEnter the second number : ");

      val2=input_val.nextInt();

      

        System.out.println("\n");

      System.out.println("\t" + val1 + " + " + val2 + " = " +  (val1 + val2));

      System.out.println("\t"+val1 + " / " + val2 + " = " +      (val1 / val2));

      System.out.println("\n");

  System.out.println("\tEnd of Program");

  System.out.println("\n");

  input_val.close();

}


}

No comments:

Post a Comment