@Guna: The outer elements are a[i][j] with i = 0 or i = n-1 or j = 0
or j = m-1. Thus, something like this will do the trick:

sum=0;
for( i = 0 ; i < n ; ++i )
    sum += a[i][0] + a[i][m-1];
for( j = 1 ; j < m-1 ; ++j )
    sum += a[0][j] + a[n-1][j];

Dave

On Sep 14, 12:35 pm, guna sekaran <vgun...@gmail.com> wrote:
> Write a program for adding the outer elements of N*M matrix

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to