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
Galician
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
So hearing this solution, there may actually be a couple of different solutions, and that's probably
okay.
If your solution is not exactly as mine.
So if the program you've written works and you can see that for a different number as you provide,
there are the same numbers of asterisks printed to the screen, then your program probably is correct.
OK, it's.
Don't.
Don't be afraid if it's not the same as the program.
I'm going to show you right now.
I'm going to show you just one option.
So in my option, we've, first of all, will create a variable that will hold the number of asterisks
that need to be printed to the screen.
So let's see.
Is something like this int narm of asterisks.
Ask the risks.
Right, if I'm not mistaken.
Then of course we need to use some input function.
Right.
To read from the user than that number.
So we are going to print enter a number of asterisks.
You would like to see.
OK.
Something like that.
Would like to do.
You would like to see.
We would like to see semicolon at the end.
And here we are going to use the scanning function and to read the value from the console and place
it inside and put it inside these variable.
And now at this point, you already have the number of asterisks that you have to print to the screen.
So to accomplish our task, we are going to use our new body, the loop body, the while loop body.
So simply write the wild statement while here's the parentheses.
And in the parentheses, you specify the condition for when the loop is going to be executed.
So none of asterisks.
As long as normal fast risk is greater than the is then zero.
There in this case, if this condition happens to be true, as long as this condition happens to be
true, we are going to execute a bunch of commands.
So the first command is, of course, the print an asterisk to the screen.
Right.
And that's how you do it.
You printed out one asterisk.
And if you're to run this program right now, actually, let's do it.
But very, very carefully.
If you're about to do it on your own in your home, make sure you're safe.
All right.
So let's build it or run it and let's place here right on all three, for example.
Oh, and we got an infinite loop.
So press control, see if you're using windows.
And we got an infinite loop in this section.
And that's not something that we wanted.
Right.
We want to now at some point to get out of this loop to make sure that this condition in the future
wants seats printed out, all of the necessary asterisks to the screen that it will stop and it will
move on to the next command.
So for that, we are just going to reduce the value of these variables by this variable, by one at
every iteration.
So simply right now or fast risk equals to normal fast risks.
Minus one.
Or you may also use just something like that.
I'm putting it in the comments here.
Now I'm off ask.
There are risks.
Minus minus.
And now on each duration we are going to decrease meant the value of normal fast risks by one.
And we will do so.
And we will do so until we reach zero, which means all the asterisks have been printed on the screen.
And while I.
Your program works.
So let's try to build and run it once again and see what happens.
So let's build and run it.
There we have the message.
Let's use three.
So we have three asterisks.
And also, if we are going to use here, I don't know, a hundred.
Let's see.
So that's probably going to be one hundred of asterisks.
And one less thing to mention here.
And we want to a little bit to separate these message from this default message printed out on the console
application.
So for that, we are going to use a basic Pring def command.
Once we are out, once we are out of the while loop, we are going to use brute F and just print F a
new line.
After we are done printing out all the asterisks here.
All right.
Good, good, good.
So that will work.
And now let's quickly take a look at another solution which is also valid.
Will first define some auxiliary variable and call it.
Let's call it.
I didn't.
I just said it to be equals to zero.
And now let's modify a little bit the while, the while condition.
We are going to say that while I is less than narm of asterisks, because in this solution, in this
example, which by the way, the previous one is valid and this one is a.
Both of them are okay, but some of you may use the previous ones, some of you will use these one,
I just want to show you another way to how it can be done.
So in this case, we don't want to change these variable.
We are just using some auxillary variable called eye that will help us with the solution.
So as long as I is less than an arm of asterisk, we are going to print half an asterisk to the screen.
And also, we are going.
Of course, to increment I by one.
So you either may use I equals two, I plus one or you can just use I plus plus.
So I will increment on each iteration until it reaches out to be equal or greater than normal fast risks.
And when it happens you just step out of the while loop and proceed with this command.
So this is it for these video guys.
Many you find out.
Maybe you found out some other approach to how you can solve it using a while loop.
So just make sure that you can see the expected result.
And the result should be the same of what you see on the screen.
Right.
There are maybe different ways to solve it, but the result here in this example should be the same.
So, as always, guys.
Thank you so much for watching.
And I'll see you in the next video.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.