0

I need add elements in 5*5 matrix such as index of the element are {(1,3),(2,2),(2,4),(3,1),(3,5),(4,2),(4,4),(5,3)} in c progra

I need solutions

1st Dec 2016, 6:59 AM
Sridhar Sankar
Sridhar Sankar - avatar
5 Respuestas
+ 2
you want to add elements just with this indexes?
1st Dec 2016, 7:29 AM
Saeed
Saeed - avatar
+ 2
for(int i=0;i<5;i++){ int t=i+1; if(t==1 || t==5){ arr[i][3]=t; }else if(t%2==0){ arr[i][2]=t; arr[i][4]=t; }else { arr[i][1]=t; } } i think is your answer
1st Dec 2016, 9:33 AM
Saeed
Saeed - avatar
+ 2
your wellcome
1st Dec 2016, 10:15 AM
Saeed
Saeed - avatar
+ 1
yes
1st Dec 2016, 8:39 AM
Sridhar Sankar
Sridhar Sankar - avatar
0
thank you
1st Dec 2016, 9:52 AM
Sridhar Sankar
Sridhar Sankar - avatar