Connecting Tech Pros Worldwide Forums | Help | Site Map

c programming

Newbie
 
Join Date: Sep 2006
Posts: 2
#1: Sep 27 '06
write a program to print sum diagonal elements of array..
2 d array (3,3)

Newbie
 
Join Date: Sep 2006
Posts: 2
#2: Sep 27 '06

re: c programming


write a program to print sum of diagonal elements of array..
2 d array (3,3)
1 2 3
4 5 6
7 8 9
print sum of 1 5 9
Banfa's Avatar
AdministratorVoR
 
Join Date: Feb 2006
Location: South West UK
Posts: 6,188
#3: Sep 27 '06

re: c programming


You clear understand what you need to do, I suggest you have a go at doing it.
D_C D_C is offline
Needs Regular Fix
 
Join Date: Jun 2006
Posts: 294
#4: Sep 27 '06

re: c programming


Here is a hint. Although the array is 2D, you can treat it as 1D since you are going along the diagonal, which relates rows to columns.
Reply