+ 1

Hey guys can some help me with loops in java

i need to print this 1.000000000 2.000000000 4.000000000 8.000000000 16.000000000 32.000000000 64.000000000 128.000000000

15th Nov 2018, 12:07 AM
Neil
2 ответов
+ 11
run a loop for 8 times & by seeing pattern its ×2 series //here is a simple code int j=1; for(int i=1;i<=8,i++){ System.out.println(j); j=j*2; }
15th Nov 2018, 9:16 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
0
Loop from 1 to 128 For the increment part dont use i++, find a relatiom between those numbers and how it increase. Inside create another loop from 1to 8 then print 0
15th Nov 2018, 12:24 AM
Taste
Taste - avatar