Question
In C: Write a program to populate a 2-dimensional array with the numbers from 1 to 100 (10 numbers per row, and 10 rows), display
In C:
Write a program to populate a 2-dimensional array with the numbers from 1 to 100 (10 numbers per row, and 10 rows), display the array, and then sum and display the numbers in the 4th column and the 9th column.
You can use an initializer list to populate the array, but you may find it easier to use a pair of nested for loops.
Hints:
- Use the variable names row and col to help keep things clear
- If you populate the array using a pair of nested for loops, create a variable with a value of 1 and increment the variable inside the loop
- When displaying the array, the values are separated with
s ('\t') - When displaying the array, after each row loop is complete output a new line character
- When summing the numbers for each column, use a loop and keep the column constant.
There is nothing entered by the user.
Example Run:
The contents of a 2-dimensional array, populated with the values 1 to 100... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
The sum of the 4th column is xxx. The sum of the 9th column is xxx.
The example run shows EXACTLY how your program output will look.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started