for(int i = 1; i <= 5; i++) { System.out.print (i + " "); int k = 6; int sum = | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

for(int i = 1; i <= 5; i++) { System.out.print (i + " "); int k = 6; int sum =

Please explain in

10th Mar 2021, 7:10 AM
Monir Hossen
Monir Hossen - avatar
4 Answers
+ 1
this is half code. Please show us the full code and please be more relevant about the issue u r facing in it. Also, share the code link dont post it ss text as others cannot edit it. It will print. 1 2 3 4 5 as for loop ends at 5
10th Mar 2021, 7:12 AM
Sharique Khan
Sharique Khan - avatar
0
for(int i = 1; i <= 5; i++) { System.out.print (i + " "); int k = 6; int sum = i; for (int j = 1; j < i; j++) { sum = sum + k; if (sum < 10) System.out.print(sum + " "); else System.out.print(sum + " "); k++; } System.out.println(); }
10th Mar 2021, 8:58 AM
Monir Hossen
Monir Hossen - avatar
0
I understand frist loo. I don’t understand 2nd loo. Please explain.
10th Mar 2021, 8:59 AM
Monir Hossen
Monir Hossen - avatar
0
As I told you add this in code and share the link of the code.
10th Mar 2021, 9:28 AM
Sharique Khan
Sharique Khan - avatar