"Hari ini adalah hari bertuah saya. Saya datang dengan lima tugas baru untuk awak. Saya penuh dengan kreativiti. Semoga berjaya, kawan saya. Anda akan memerlukannya..."
2
Tugasan
Java Syntax, tahap, pelajaran
Even numbers
A for loop simplifies the counting, simplifies displaying text, and simplifies... the life of a programmer! And it saves a lot of time: just a couple of simple lines of code and you can display every even number from 1 to 100 inclusive. Let's try it, but be sure to put each value on a separate line.
4
Tugasan
Java Syntax, tahap, pelajaran
Drawing a rectangle
Expressive drawing using the modest tools of pseudographics is the same as minimalism in music. At least, some critics on Earth think so. Well, let's heed their words and do some drawing. Let's enter two numbers m and n, and draw a rectangle of eights. The rectangle will be m eights high and n eights wide.
4
Tugasan
Java Syntax, tahap, pelajaran
Triangle of eights
Drawing on the console is called "pseudographics". This technique began at the dawn of the computer age and progressed in parallel with ordinary graphics until the beginning of the Windows era. Then it stagnated and faded away. Maybe you daydream about great pseudographics? Let's start mastering the technique by drawing a "triangle of eights".
2
Tugasan
Java Syntax, tahap, pelajaran
Drawing lines
Everything starts with lines, including the path of an artist. But the path of a programmer begins with the study of loops. At this point, we need to master the for loop. It is convenient, simple, and helps us create. Let's use it to draw horizontal and vertical lines, consisting of ten 8s each.
2
Tugasan
Java Syntax, tahap, pelajaran
Chain letter
Who (or for some people, what) do you see in your sweet dreams? Do you have someone in mind? Make a wish. Write a program that takes a name from the keyboard and displays the phrase " loves me" 10 times. If you do this with a for loop, your wish* will come true (*your wish to become a programmer).