Using C/C++, define a two dimensional integer array with 5 rows and 5 columns (a
ID: 642998 • Letter: U
Question
Using C/C++, define a two dimensional integer array with 5 rows and 5 columns (a total of 25 integers). Assign the array with random numbers between 10 and 100 using rand(); then define two arrays; S[5] and A[5] and use loops to calculate the sum and average of the numbers in each column the two dimensional array (i.e. numbers that have the same column index) , assign the results to S[5] and A[5], respectively. Output S[5] and A[5] results; finally, count the even integers of the array and output the result.
Explanation / Answer
#include #include using namespace std; int main() { int array2D[10][10]; int sum100s = 0, sum10s = 0, sum1s = 0; //fill 10x10 array with random numbers between 100 and 1000 for (int x = 0; xRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.