Solved

writing a nested loop structure

Posted on 2000-03-01
1
212 Views
Last Modified: 2010-04-15
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
Comment
Question by:beachbumm
1 Comment
 
LVL 16

Accepted Solution

by:
imladris earned 25 total points
Comment Utility
int i,j;

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now