Writing lettet M using for for loops and switch | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Writing lettet M using for for loops and switch

The height of letter M is determine by for loop. Use switch and System.out.println("* *"); System.out.println("* * * *"); System.out.println("* * *"); System.out.printlin("* * *"); to print stars. You basically have a simple solution. Their advance solutions much more complicated.

2nd Apr 2018, 10:45 AM
Luther Conley
4 Answers
+ 1
that is absolutely correct
4th Apr 2018, 6:07 AM
Tedros Gebru
Tedros Gebru - avatar
+ 1
that is absolutely correct
4th Apr 2018, 6:07 AM
Tedros Gebru
Tedros Gebru - avatar
+ 1
hy xan I am teddy department of software engineering. .nice to meet you
4th Apr 2018, 6:27 AM
Tedros Gebru
Tedros Gebru - avatar
0
Here's the 'simple' version, which implements the version you specified: https://code.sololearn.com/chVdU1Dc3R0W/#java Here's a more complicated version that creates a canvas made out of characters. Any lines can be drawn to the canvas (drawn as asterisks). I currently draw 4 lines, representing a capital letter M. Note that this code doesn't have good enough error checking yet! It is just to give an idea of what is possible. https://code.sololearn.com/cLYRWvV9vDM3/#java This took me several hours to do! I really enjoyed the challenge! :-) Let me know if you have any questions.
2nd Apr 2018, 9:46 PM
Emma