Answer to Question #281601 in Java | JSP | JSF for Copper

Question #281601

Write a program to store following numbers in an array

3 10 -15 20 12 8 -3 7

then display all the numbers without showing negative numbers(i.e. -15 and -3)


1
Expert's answer
2021-12-21T06:16:10-0500


public class App {


	/**
	 * The start point of the program
	 * 
	 * @param args
	 * 
	 */
	public static void main(String[] args) {
		int numbers[] = { 3, 10, -15, 20, 12, 8, -3, 7 };


		for (int i = 0; i < numbers.length; i++) {
			if (numbers[i] < 0) {
				System.out.print(numbers[i] + " ");
			}
		}


	}
}

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