Multidimensional Arrays (Solved Problem)

preview_player
Показать описание
C Programming: Multidimensional Arrays (Solved Problem)
Topics discussed:
1) C program to read a 5x5 array of integers and then print the row sum and column sum.

Music:
Axol x Alex Skrindo - You [NCS Release]

#CProgrammingByNeso #CProgramming #Arrays #MultidimensionalArrays #ArraysInC
Рекомендации по теме
Комментарии
Автор

I definitely prefer this channel for c programming to everyone

charlesantony
Автор

for the column sum if we just change the line sum+=[ i ][ j ] to sum +=[ j ][ i ] it should work

arunimaaa
Автор

It feels good when my solution more or less matches the instructors. 🥰

Jeremyak
Автор

i feel like my mind is expanding by solving this problem

yagneshacharya
Автор

For column sum, I simply did this sum+=a[j][i];

roshanmhatre
Автор

you can also make an array of rowsum and columnsum initilizing all the indexes to 0 to store the sum's without directly printing it in the for loop

timsinajiven
Автор

instead of changing for loop we can directly change sum=sum+a[j][i];

akashpurbia
Автор

@nesoacademy sir, I have watch these videos I request you to to please suggest me which course to opt for more competitive programming . Please

Shivam-ehfc
Автор

Hi! its so a beutiful about 3D explanation of array, kick up brother

lucianmwingizi
Автор

Please answer this- how compiler knows that i is row and j is column ??

sahil
Автор

from where you come with these interesting programs ?? :( I want it to practice

qandos-nour
Автор

Sir, is this program of multidimensional array?

ishwarikorde
Автор

I guess this is a better approach to solve this question-
int row[5]={0}, col[5]={0};
for(int i=0; i<5; i++)
{
for(int j=0; j<5; j++)
{
row[i]+=arr[i][j];
col[j]+=arr[i][j];
}
}

ritikrustagi
Автор

If you get the first element in the first array so huge, that becuase of garbage value, you need to initialize the sum variable first like : int sum = 0; and not like int sum;

Codality
Автор

sir instead of changing loop just interchange i and j in the row sum code for column sum code

manikantavaraprasadvemula
Автор

Great very help full but can i get the same version of this but in Javascript?

kingelvis
Автор

can you please tell me how to store int values from file to 2d int array but without know how to do this with 1d array with grow capacity function but i have tried many times to do that in 2d array but i didn't succeed .if you know how to do this then please tell me .

farrukhkhalid
Автор

Can you help me with an array program which which is 5 by 5 but this time when it’s the user going to input those values and it calculates average for every row ? 🙏

mukstymug
Автор

Similar, less verbose python solution:

def sum_row_col(arr):
row_total = []
col_total = []
for row in arr:
row_total.append(sum(row))
for i in range(len(arr)):
curr_col =[arr[0][i]]
for j in range(1, 5):
curr_col.append(arr[j][i])

return f"row total: {row_total} \ncolumn total: {col_total}"

saulfeliz
Автор

Sir if you really want to help us explain how to solve these types of questions which is asked frequently in Gate.
main()

{
int arr[2][3][2] ={{{1, 2}{3, 4}{5, 6}}, {7, 8}{9, 10}, {11, 12}}};
printf("%d%d", a[1]-a[0], a[1][0]-a[0][0]};
return 0;
}
assume int is of 2 bytes

JackyShaw