Answer :
To determine whether each item in the given array is divisible by 3 or not, iterate through each element in the array using nested for loops. Use the modulo operator to check if each element is divisible by 3. Replace non-divisible elements with 0.
To determine whether each item in the given array is divisible by 3 or not, we can use modular division. We can iterate through each element in the array using nested for loops. For each element, we can use the modulo operator (%) to check if it is divisible by 3. If the remainder is 0, then the element is divisible by 3. If not, we can replace the element with a 0.
Here is the step-by-step process:
- Loop through each row in the array using a for loop.
- Within the first loop, loop through each element in the row using a nested for loop.
- For each element, check if it is divisible by 3 using the modulo operator (%).
- If the remainder is 0, leave the element as-is.
- If the remainder is not 0, replace the element with 0.
- Print the updated array.
Learn more about divisibility by 3 here:
https://brainly.com/question/35122786
#SPJ11