Machine Problem

Creating a Java Program will print the Sum (Addition), Difference (Subtraction), Product (Multiplication), Quotient (Division) of five numbers.

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.Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGgThank you very much for your support.

Program Listing

/* basic_math.java
 *  
 *  Jake Rodriguez Pomperada, MAED-IT, MIT
 *  www.jakerpomperada.com and www.jakerpomperada.blogspot.com
 *  jakerpomperada@gmail.com
 *  Bacolod City, Negros Occidental Philippines
 * 
 */

import java.util.Scanner;


public class basic_math {
	
 
	public static void main(String[] args) {
		
	    Scanner input_val= new Scanner(System.in);
		
		 int array[] = new int[5];
		 int a=0,b=0,c=0,d=0,e=0;
	     int addition=0,subtraction=0,multiply=0, quotient=0;
        
    	
		  System.out.println("\n");
		  System.out.println("\tBasic Math Operations Using Arrays in Java");
		  System.out.println();
	      System.out.print("\tInput first number  : ");
	      a = array[0]=input_val.nextInt();
	      System.out.print("\tInput second number : ");
	      b = array[1]=input_val.nextInt();
	      System.out.print("\tInput third number  : ");
	      c = array[2]=input_val.nextInt();
	      System.out.print("\tInput fourth number : ");
	      d = array[3]=input_val.nextInt();
	      System.out.print("\tInput fifth number  : ");
	      e = array[4]=input_val.nextInt();
	     
	      addition = (a+b+c+d+e);
	      subtraction = (a-b-c-d-e);
	      multiply = (a*b*c*d*e);
	      quotient = (a/b/c/d/e);
	      
	      System.out.println();
	      System.out.println("\tThe sum of " + a + " numbers " + addition);
	      System.out.println("\tThe difference of " + a + " numbers " + subtraction);
	      System.out.println("\tThe product of " + a + " numbers " + multiply);
	      System.out.println("\tThe quotient of " + a + " numbers " + quotient);
	      
	      
	      input_val.close();
	}

}

Leave a Reply

Your email address will not be published.