Download presentation
Presentation is loading. Please wait.
Published byNadine Reuter Modified over 5 years ago
1
Print the following triangle, using nested loops. 1 2 1 2 3 2 3 4
Problem Print the following triangle, using nested loops. 1 2
2
Algorithm Dry Run i=1 Step 1:- run the for loop from 1 to 5 with i as iterating value i=2 i=3 i=4 i=5 j=1 j=1,2 j=1,2,3 j=1,2,3,4 j=1,2,3,4,5 Step 2:- run second for loop with j from 1 to i Step 3:- print the value of j 1 1 2 1,2,3 1,2,3,4 1,2,3,4,5 Step 4:- print next line \n \n \n \n \n
3
Task 19 Print using nested for loops 1 1 2 Task 20 Print using nested for loops 1 2 2 Group work Print using nested for loops * * * * * * * * * * * * * * * * * * * * * * * * *
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.