what is formula of nested loop?
please tell me
zahidhcy
0
Newbie Poster
Recommended Answers
Jump to PostThere is no formula, unless you mean syntax.
Jump to PostNesting a loop inside another loop is very common.
Suppose you have a matrix of integers.
Suppose the matrix has 3 rows and 4 integers in each row ...
Now if you wanted to print out that matrix, a common C, simple way, would be to code like this:
Jump to Postcode for above post :)
int matrix[3][4] = {{3, 4, 5, 6}, {1, 4, 6, 9}, {8, 3, 5, 2}}
Printing the array using nested for loops:
for(int i = 0; i < 3; i++){ //initialize the for loop. for(counter var; exit condition; …
All 11 Replies
iamthwee
soutrik
-2
Newbie Poster
David W
131
Practically a Posting Shark
DarkLightning7
12
Junior Poster in Training
David W
131
Practically a Posting Shark
happygeek
2,411
Most Valuable Poster
Team Colleague
Featured Poster
David W
131
Practically a Posting Shark
David W
131
Practically a Posting Shark
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
حسنين_1
0
Newbie Poster
Unimportant
18
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.