0
Draw a continuous wave
What can I do to make the wave go vertical, rather than horizontal, based on how many times the user wants it go based on his input? import java.util.Scanner; public class Wave { public static void main(String[] args) { System.out.println("Enter how long you want your wave to go: "); Scanner s = new Scanner(System.in); int x = s.nextInt(); for (int i = 0; i < x; i++) { System.out.print("* *"); System.out.print(" * * "); System.out.print(" * * "); System.out.print(" ** "); } } }
5 ответов
+ 4
This is solution extending your idea and and works up to screen width:
https://code.sololearn.com/c3UeAaN9rgTR/?ref=app
0
Use System.out.println as method
"println" prints each string in a new line while "print" prints in same line
0
then i just get a line of * *** ** * ** *** **************. i need to loop the V many times, horizontally (sorry, i wrote vertically, my bad)
0
Barbarian if i input 2,then how exactly the pattern should look like ?
0
* ** *
* * * *
* * * *
** **
and so on