0
Can anybody plz give a task based on loops topic?
10 Antworten
+ 1
maybe ?
print the multiplication table
Outputs
01 02 03 04 05 06 07 08 09 10
02 04 06 08 10 12 14 16 18 20
03 06 09 12 15 18 21 24 27 30
04 08 12 16 20 24 28 32 36 40
05 10 15 20 25 30 35 40 45 50
06 12 18 24 30 36 42 48 54 60
07 14 21 28 35 42 49 56 63 70
08 16 24 32 40 48 56 64 72 80
09 18 27 36 45 54 63 72 81 90
10 20 30 40 50 60 70 80 90 100
https://en.m.wikipedia.org/wiki/Multiplication_table
+ 1
the program does not print anything,
try using two loops to multiply numbers
+ 1
no, you have multiplied each number by 2.
you have to do multiplication of the number i by each number j
for example,
i = 1 and j = 1
i * j later, increase the number j by 1, i.e.
i = 1 and j = 2
i = 1 and j = 3
.......
i = 1 and j = 10 then
i = 2 and j = 1
to the moments when
i = 10 and j = 10
hint, use 2 loops for
+ 1
ok, now set "i <= 10" then add the second loop, "for" to increase the number j by 1
tip:
for () {
for () {
}
}
use system.out.print () and system.out.println () to separate lines
+ 1
good work, that's what it was all about, let's keep it that way
0
hai! daneil i got it see is correct or wrong ?
0
hai see this
0
daniel bro see now i got it
0
i never tried this type of loops
thx for giving me task
0
thx bro