Sunday, May 2, 2021

Addition of Three Numbers in Java

 

Write a program in Java that will ask the user to input three numbers and then the program will find the total sum of three numbers given by our user.

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 at 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 jakerpomperada@gmail.com and jakerpomperada@yahoo.com






Program Listing


addition_of_three_numbers.java

/**

 * @author Jake Rodriguez Pomperada,MAED-IT, MIT

 * www.jakerpomperada.com    www.jakerpompomperada.blogspot.com

 * jakerpomperada@gmail.com

 * Bacolod City, Negros Occidental Philippines

 *

 */

import java.util.Scanner;


public class addition_of_three_numbers {


/**

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner scan = new Scanner(System.in);

  System.out.println();

  System.out.println("===== Addition of Three Numbers in Java =====");

  System.out.println();

  System.out.print("Enter First Number : ");

  int a = scan.nextInt();

  System.out.print("Enter Second Number : ");

  int b = scan.nextInt();

  System.out.print("Enter Third Number : ");

  int c = scan.nextInt();

  int sum = (a+b+c);

  System.out.println();

  System.out.print("The sum of "+ a  + " , " + b + " and " 

  + c + " is " + sum + ".");

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

  System.out.println("=====   END OF PROGRAM =====");

  System.out.println();

}


}


No comments:

Post a Comment