Answer to Question #276677 in Java | JSP | JSF for Bella Wang

Question #276677

Write a program using one-dimensional array that determines the highest value among the five input values from the keyboard and prints the difference of each value from the highest.


the result would be:


Enter ten numbers:

 8   9    7     10   25  30  69  101  1001  798


Here is the list of Even number/s:

8 10 30 798

1
Expert's answer
2021-12-07T09:21:28-0500
import java.util.Scanner;


public class App {


	/**
	 * The start point of the program
	 * 
	 * @param args
	 * 
	 */
	public static void main(String[] args) {
		Scanner keyBoard = new Scanner(System.in);
		int numbers[] = new int[10];
		System.out.println("Enter ten numbers: ");
		for (int i = 0; i < numbers.length; i++) {
			numbers[i] = keyBoard.nextInt();
		}
		System.out.println("Here is the list of Even number/s:");
		for (int i = 0; i < numbers.length; i++) {
			if (numbers[i] % 2 == 0) {
				System.out.print(numbers[i] + " ");
			}
		}
		keyBoard.close();
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS