Solved

# writing a nested loop structure

Posted on 2000-03-01
248 Views
Consider the two-dimensional and one-dimensional array structures defined below:

double table[5][5]=
{
{ 3, 4, 5, 6, 3},
{ 2, 1, 2, 1, 1},
{ 3, 2, 1, 4, 9},
{ 1, 0, 0, 1, 1},
{ 9, 2, 6, 4, 9},

}

double lst[5] = {2,1,2,3,4};

I need to write a nested for loop structure to subtract the array lst from each row of the two-dimensional array table. for example, after completion, the first row of table will be 1,3,3,3,-1 since 3-2=1, 4-1=3, 5-2=3, 6-3=3, 3-4=-1
0
Question by:beachbumm
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
1 Comment

LVL 16

Accepted Solution

ID: 2573000
int i,j;

for(i=0; i<5; ++i)
{   for(j=0; j<5; ++j)table[i][j]-=lst[j];
}
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

chcp 65001 File encoding 66 319
c++ getting the first 10 characters of a char* string 11 108
valid enum? 6 81
C++ :Change value from  DisableCMD registry 4 77
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
###### Suggested Courses
Course of the Month9 days, left to enroll