?
Solved

a forloop inside a forloop - need help with logic

Posted on 2009-12-30
4
Medium Priority
?
160 Views
Last Modified: 2013-11-23
I have 2 arrays with size of 100. These arrays have elements inside them.

Lets say i have array1 and array2. I want something as follows ;

array1[1] then enters forloop and checks 1-50of array 2.
array1 goes to [2] and checks 1-50
and so on.

if i do just the basic a forloop inside a forloop for example ..

for(int i = 0; i<50; i++){
for(int i = 0; i<50; i++){
}
}

Would that work?
0
Comment
Question by:rinengan
4 Comments
 
LVL 92

Expert Comment

by:objects
ID: 26149855
for(int i = 0; i<50; i++){
for(int j = 0; j<50; j++){
}
}
0
 
LVL 6

Expert Comment

by:Roger Neyman
ID: 26151288
Yes, that would work - the inner loop would be repeated for each pass through the outer loop.
0
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 2000 total points
ID: 26151550
i think he is looking for

for(int i = 0; i<100; i++)
{
   for(int j = 0; j<50; j++)
  {
  }
}

since he is looking for 50 elements only in the second array not the first one.

0
 

Author Comment

by:rinengan
ID: 26152815
thanks alot guys, i just wanted 2 check with u if its alright :]
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses
Course of the Month3 days, 11 hours left to enroll

600 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