Week 3 Arrays
Week 3 Arrays
Week 3
Arrays
Arrays
● If we want to store data we use variables. But if we want
to store a lot of data, we will need to create a lot
variables to store it and this is not always effective.
● Declaring Arrays:
int x[5][6];
Array_Name[Row_Index ][Column_Index ]
Multidimensional Arrays
◆ Accessing the elements of a matrix using loops:
- Here, we have used a
nested for loop to access
the matrix elements.
2. Write a program that takes a 2D array of integers of size (N x N) from user and
print the summation of even numbers in each row and the summation of odd
numbers in each row
● ex: subsequences of {1,2,3,4} are {1}, {2}, {3}, {4}, {1,2}, {1,3}, {1,4},
{2,3}, {2,4}, {3,4}, {1,2,3}, {1,2,4}, {1,3,4}, {2,3,4}, {1,2,3,4}.
Facebook Group
Sheets