0
Write a JAVA code to represent the following series: 1,2,4,8,16,32,64 by using do –while.
I need the result
11 Respostas
+ 6
Let <i> = 1
Print <i>
Begin loop
Multiply <i> by 2
Print ", " followed by <i>
While <i> < 64
As @visph suggested, use System.out.print() for printing values rather than System.out.println().
Try to implement this into a code
And please put Java in your thread's tags above (where you wrote 1) ☝
+ 2
by using print instead of println (print line: add a new line char at end)
+ 2
you must also add some space or separator between numbers ;)
+ 1
You must try and show your attempt before we can help you
+ 1
tips: it's powers of two serie
+ 1
public class Main {
public static void main(String[] args) {
int i = 1;
int mul=1;
do {
System.out.println(mul);
mul*=2;
i++;
}
while (i < 8);
}
}
+ 1
Please read the rules before posting
https://www.sololearn.com/Discuss/1316935/?ref=app
0
How do I make it in a series I can do it only vertically
0
Can you write it in code so that the picture is clear to me?
0
you should try yourself to be able to learn...
0
Well, thank you, brother