Question: Problem Statement: Write a Java program that does the following: 1 . Creates an array of 1 0 0 integers. 2 . Initializes the array
Problem Statement:
Write a Java program that does the following:
Creates an array of integers.
Initializes the array with a regular for loop to have values to
Meaning the first element has the value of and the last element has the value of
For each element in the array:
If the element is divisible by replace it with its half ie divide by
If the element is divisible by replace it with its triple ie multiply by
If the element is divisible by replace it with its square ie multiply it by itself
If none of these conditions are met, leave the element unchanged.
If an element meets more than one of the above criterias for example is divisible by and
apply the first condition it meets so in the case of which is divisible by and
replace it with it's half, which is
Print the original array, and then print the modified array after applying the above rules.
Requirements:
You must use a D array of integers.
The moduloremainder operator should be used to check divisibility conditions.
Do not use any methods to solve this task; the entire logic should be written within the main method.
Sample Output:
Original Array:
Modified Array:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
