/* * Autor: Juan Antonio Ripoll * Date: 30/10/13 * * Write a JAVA program to calculate and display the average * of four numbers entered by the user. * */ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter a number1: "); int number1 = in.nextInt(); System.out.print("Enter a number2: "); int number2 = in.nextInt(); System.out.print("Enter a number3: "); int number3 = in.nextInt(); System.out.print("Enter a number4: "); int number4 = in.nextInt(); System.out.println("Average: " + (number1 + number2 + number3 + number4) / 4); } }
Wednesday, October 30, 2013
1.09 - Average
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment