?
Solved

writing a nested loop structure

Posted on 2000-03-01
1
Medium Priority
?
253 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
[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
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
imladris earned 75 total points
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
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 conditional statements in the C programming language.
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 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