All language subtitles for 15. For Loops in C Programming Language

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

What is going on, guys?

My name is Vlad.

And in this video, we are going to take a look at for loops in C programming language at this point.

We understand the concept and the main principles of for loops as we've discussed it in the previous

video.

And now it's time for some Hands-On.

So supposedly you have to write a program that reads a number from the user and then prints all the

numbers from one to you.

That particular number.

So first of all, we just create declaring non variable.

Then we read it from the user and through a number.

And based on the number of that the user inserts, we are going to print all the numbers, all the numbers

from one to these particular numbers.

So while if, for example, he entries in NUM equals to five, we are going to print one, two, three,

four, five.

Is that clear?

And if the user inserts ten, then we are going to print all the numbers from one to ten and so on.

Basically you got the idea.

So one of the ways to do so would be by using the four loops.

So basically the structure would be something like that.

So first of all, you specify the four statement.

You use the four.

And then you are going to have the parentheses to hold the three states or condition was specified in

the previous video.

So first of all, we are going to have the initialization phase phase and initialization phase, which

basically you specify that I will be equal to one.

And you only run this command only for the first time that you happen to see these for a loop.

So there you go.

For example, you print this line for the screen, then you read the value from the user.

And the first time that you come to this fourth statement to the force structure, only now you're going

to set this value to be equal to one and then you move on to the loop condition.

And in this condition, you actually check whether AI is less than or equal to NARM.

And if the result of the condition happens to be true or better as say, as long as this condition happens

to be true, you are going to execute the loop body.

So on every duration, once again, on every duration that you are going to execute the slope, you're

going to check if this condition is satisfied.

If it's satisfied.

If it's true, you are going to execute.

If it's false, you are going to be kicked out.

Let's say this way to be kicked out.

Out of this for a loop end to proceed on with your program.

So let's say that you've, Ryan, of these for the first time, you've ran the first iteration, you

checked out.

This condition happens to be true.

One is less than five.

Let's say that name is five.

So you printed out one to the screen, right?

Because the value of AI is just one.

You printed out one to the screen on the first iteration.

Then you come to the end of this loop body.

And what happens now?

Now, what happens is these Abdeen statement is being executed, meaning that AI is getting increased

by one.

Right.

And from this point on, before we start the second iteration, I will be equal to two.

So this happens after any duration is over.

And we print it out on the screen.

Then we incremented.

We updated this statement.

We incremented I by one.

And then to enter the loop body to run the loop body once again.

We check out if this condition is true or false.

And in this case, two is less than or equals two to five.

Right.

This condition is true.

Then we are going to execute the loop body once again.

All right.

So this is the new body we are going to executed once again.

And we are going to print to to the screen.

So also, we do it the same way for the 30 duration.

We increment I by one.

I will be equal to three.

Three is less than five.

We're going to print three to the screen.

And so on until we reach some condition that I will be or it will be greater than five.

Right.

If it's five, five is less than or equal to NARM.

So five will will be printed.

And we will see all the numbers from one till four to five on the screen.

And then we run this print f commented once again we increment I by one end.

And now I will be equal to six.

And six is not less than or equals to five than the result of this condition will be false.

And that means that you are not going to execute this loop body and you're going to step out of the

for a loop.

And just to proceed with your programming in this case, just return zero and get it over with.

All right.

So I hope you've got the point.

And just to make sure that you understand all the flow of of this code correctly, let's see another

example where we go step by step in the most detailed explanation, because a lot of student.

Are struggling at this point, and I don't want you guys to be one of these students that struggle at

for loops.

So here we come for the first time, we come from this line.

And what we are doing is we set of the value of I to be equal to one than we are.

All right.

We have here the variable I we set it to be equal to one and then we are moving on the little body.

So the first command that will be executed is the printf command.

And we can see, let's say that this is the screen of your computer.

This is the console application.

We are going to see that one has been printed out to the screen.

And now we come back to the end of the look of the loop, buddy.

And what we should do from now on.

From now on, we should move here and increment I by one.

So now the variable I we created a variable I in the first steps of our program, this variable will

be incremented by one.

So I will be equal to two.

From this point on before we start the second the duration.

So now we are going to come here only only if this condition is satisfied.

And to do we can see that I equals to two.

That two is less than five.

Nahm in our case was five.

So now we are going to run this command once again.

So print f the value of I.

And now the value of Feis to us.

So we are going to print to, to the screen.

And now we are going to repeat this process.

So we are going to increment I by one and I'm going to be equal to three.

Then we come again for the loop body based on the result of this condition.

We checked it on.

The result is true.

So now we execute this line one once again.

And we can see that all the numbers will be printed as a screen.

My bet.

The user didn't enter a name equals to five, but rather he entered nom equals to ten.

I forgot exactly what he enters.

Right.

It's late hours right now.

So please forgive me, guys.

And I basically hope that you got the idea of how this code works and you just run this little body

over and over again until this condition.

Feel this condition is will be false.

And while it's not false, let's say.

And on the end of every duration you use of this command to increment I by one in this example.

It's it's just by one.

It may be in other value.

It may be another command, whatever you you choose.

And also just remember that this line, that this command is executed just once when you come for the

first loop for the first time.

All right.

So now let's take look at another example where we have to print just odd numbers.

All right.

From one app to a given number that the user provides.

It's pretty similar to what we've done in the previous example.

But there just now, we are going to print all the numbers from one of the old numbers sorry, all the

old numbers from one field.

These given no.

So the steps are very similar.

First of all, we will create AI to be equal to one.

So there you go.

You, first of all, created AI.

All right.

This is this line we we presented with this box and then we use said this value to be equal to one.

And then we are going to execute the loop body and print one to the screen.

So one will be printed here.

Now we can see that the little buddy is over.

And what we should do now.

Should we increment just by one as previously?

And then we will print one, two, three, four or five, six, seven and so on.

But that's not exactly what we want to do.

We want to bring just the odd numbers.

So on every direct iteration, on the end of at the end of every iteration, we are going to increment

the value of AI by two.

So in this case, we run these command AI equals to the previous AI plus two.

So the value of AI becomes three.

And now once you come back to the Labadee, you're going to print three two discrete to the screen and

then you increment the value by or by two.

You are going to have here five and you're going to print five and so on.

So for us, simply printing out all the odd numbers from one to these given narm that the user specifies.

And that would be it for these video guys.

And I think and I hope you understand now much better how the four loops work and see how this syntax

looks like.

What are all these commands to what they relayed.

Which commands.

Ron.

Before the iteration.

After the iteration.

What is the condition that is checked.

If the loop body should be executed or not.

And we've seen full examples demonstrated line by line, command by command.

What commands are executed and when?

So I think you can say that, you know, for a loops.

And now I would say that it's time to give it a little bit of practice on your own.

So I'll see you in the next.

Challenge.

Good bye, guys.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.