Write a Java program that creates an array that can hold 50 integer values. Using a for loop, fill the array with even integer values between 2 and 100 inclusive. Then make a separate for loop to print each of the numbers in the array horizontally with a single space between each number. (If you want to be more adventurous, you can fill it with random numbers between 2 and 100) Note: When using a for loop with arrays, use the variable name "index" as the counter in the loop as shown below. This reinforces the fact that integer number that is changing represents the index of an array element. for(int index = 0; index < myArray.length; index++){ // body of your for loop code goes here } // end for
Write a Java program that creates an array that can hold 50 integer values. Using a for loop, fill the array with even integer values between 2 and 100 inclusive. Then make a separate for loop to print each of the numbers in the array horizontally with a single space between each number. (If you want to be more adventurous, you can fill it with random numbers between 2 and 100) Note: When using a for loop with arrays, use the variable name "index" as the counter in the loop as shown below. This reinforces the fact that integer number that is changing represents the index of an array element. for(int index = 0; index < myArray.length; index++){ // body of your for loop code goes here } // end for
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 16PE
Related questions
Question
Jana
Java
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage