?
Solved

writing a nested loop structure

Posted on 2000-03-01
1
Medium Priority
?
260 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 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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 and use structures 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

850 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