Edhesive 10.4:
For this exercise, use the following 2D array, which is already declared and initialized in your programming environment below.
34 38 50 44 39
42 36 40 43 44
24 31 46 40 45
43 47 35 31 26
37 28 20 36 50
Your task is to determine whether each item in the array above is divisible by 3 or not. If an item is divisible by 3, then leave that value as-is in the array, but if it is not divisible by 3, then replace that value in the array with a 0. Remember that you will need to use modular division from Unit 2 to determine if a value is divisible by 3. Finally, print out the array in the format as seen in the sample run below.
Note: Be sure that your program accounts for arrays of any size, not just arrays that are 5 x 5. Your program will be tested against arrays of size n by n. It should work for any square array, not just the one shown. You should also use for loops in your program, not while loops.
1
Expert's answer
2020-11-20T19:59:56-0500
Dear a, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment