+ 1
for(int i = 1; i <= 5; i++) { System.out.print (i + " "); int k = 6; int sum =
Please explain in
4 odpowiedzi
+ 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
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();
}
0
I understand frist loo.
I don’t understand 2nd loo.
Please explain.
0
As I told you add this in code and share the link of the code.