Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Welcome back.
So I hope you've tried and solved this exercise successfully, and what we are going to do now is simply
do this exercise together.
So get yourself ready and make sure you check out everything you've written on your own and that everything
seems to be working correctly.
So now what we are going to do is simply to remove these print offline, because we know, first of
all, that we have to print some pattern that just looks like this.
Right.
So, Dan, what is it?
One five 10 asterisks are two in each row and we have a total of five rows just like that.
So one, two, three, four or five.
So that's the that's the pattern that we want to see printed on the screen.
Right.
Just like we've printed some numbers, we also can print some other characters just like these asterisks.
And that's exactly what we are going to do right now.
So what what do we have to do?
First of all?
First of all, we need to understand that we can do it in two ways and we can do it like to use a printing
command to print each line, each line to print with ten asterisks.
So, for example, it will look like this.
So print f, print F simply all these function does is to take some, let's say, string for now, some
bunch of characters and represent them and bring them to the screen so it will look something like this
or print F and one, two, three, four, five, six, seven, eight, nine, 10.
Right.
So and then we will add the semicolon at the end to specify that this command is over and complete.
All right, so we know that these come in printed just one line, so let's simply copy this line and
printed once again five times, right.
So we have here five rows.
And the question is, is this pattern that we can see right now here on the screen, will it be printed?
Exactly.
Just like this if we will build and run this program?
So let's build and check it out.
So build and run.
And you can see here on the screen that not we cannot see the whole pattern, although we can see a
lot of asterisks printed through the screen right now.
But it's not a lot of it's not actually the pattern of the rectangle that we wanted to print.
All of them are printed in just one line.
So one of the things that you have to understand is that after every printer here, we will use a backslash
and character that simply specifies that we are going to go one line below in the printed result.
So let's listen in.
There you go.
Let's build and run it once again.
And we'll first of all, we had all of the characters, all of these 50 characters on just one line.
And now hopefully we will see that pattern that we were expected by using these backslash m so these
backslash and you can see it right here after ten characters.
After all of these characters, there is a new line printed on this console application and after another
attempt asterisks a new line again.
And there you go again and again.
And basically you can see that that's exactly the pattern and the rectangle that you expected to see
in.
One main question that students ask me later on in the Q&A section is why did we have to use here five
printer commands?
So basically, couldn't we just take it?
And instead of using five printer commands, just combine all of them in just one print of command.
So take a second and think about it.
But the question is pretty obvious is that we can do it.
So what we will simply do is just take every 10 asterisk and put them inside here and put it back in
to an asterisk, a backslash n again.
And finally and what we have done here is simply specifying in one print of command instead of using
five, we simply specify that print have 10 asterisks after words print in your line.
Right.
Because we want to move a new line ahead and then print an asterisk once again, print a your line and
there you go again and again and again.
How many times.
Five times.
Right.
Because we have five rows and we have ten columns in each row.
And that's exactly what we are doing right here.
So let's build and run it once again to make sure that everything seems to be working correctly.
So there you go.
There is our pattern and basically two options.
You've seen how you can do it using five print F commands when each print off line simply represents
one row in the pattern or how you can do it just by using one print off-line, using these combinations
of properly putting these backslash and inside of the command itself.
So I hope everything is clear, guys, and I hope you're ready for your next exercises.
I'll see you then.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.