OK, so let us discuss the last problem of part two.
So problem Lamberti.
The problem statement is read in and print full length by 10.
Brent following pattern.
If the really of and is three, the pattern will look like this.
If the value of and is too bad, then will look like this.
And if the value of N is five, the better would look something like this.
OK, so how we can solve this problem?
If you look carefully, if the value of.
T.
I am printing three.
If the value of Venice to I am printing doodles.
If the value of wine is five, I am printing faithful's.
So one thing is very clear here that I need a loop and this loop will run and times.
Because we have to print Enda's is the value of.
Is three.
This look Willdan two times.
If the value of N is to this look vildan two times.
And if the value of an is five this look Willdan five times.
OK, so let us revise.
So the problem was I have to read and and we have to print following patterns over the value of ancestry.
I have to print materials.
If the value of I need to I have to print to.
If the value of finance life, I have to print five rolls.
So I told you that I need a loop.
And this look, Willdan end times because we have to print.
And those.
OK.
So how will this loop run and times?
So I will use a variable eye which is initialized to one is I less than Noriko's two n.
And I equals a plus one.
So with the help of these three blogs, this loop will run end times.
OK.
And inside this loop.
Each time.
What will I do?
I will print all.
I'm putting myself each time this loop is running, I will print Arrow.
OK.
This loop is running and times, and each time I am printing, I do so in total I will be able to print
Ando's.
So the approach is very simple.
This loop is ending and times and each time I am printing Adderall.
So finally I will be able to print and lose.
Now, the second problem, how to print a rule.
How will I bring that to.
So if you look carefully each time, I have to print different oral.
Here, the value of I is three here, the value of AI is to value of to vilify one.
So if the value if I is when I have to print just one star is the value of AI is do I have to print
those stars.
If the value of AI is three, I have to print two stars.
You can look here, also here I equals four here and I equals five and so on.
Here I equals one.
So if the value of AI is one, I have to print just one star.
If the value of I used to I have to print two stars and if the value of AI is five, I have to print
five stars.
So for printing a rule, I need a loop and this loop will run eight times because you can see here if
the value of AI is three.
I am printing three stars.
If the value of AI is two, I am printing two stars.
If the real fight is won, I am printing one stars.
So that is the reason I need a lube and this loop will run eight times.
OK, so how will I run this loop by eight times.
I will use a variable G which is initialized to one.
Then I will check.
Is G less than or equal to a.
And J.
Equals J plus one.
So with the help of these three blogs, this loop will run eight times.
OK.
So let us revise.
So the question was, I have to print oral.
So how do I bring Durrow?
So I told you, if you look carefully, if the value of history I am printing through Rose.
If the value if I is true, I am printing to Rose.
If the value.
If I is when I am printing Wendle.
So I need a loop.
And this loop will run eight times, and each time I will print.
I start OK.
So each time I am printing, I start.
And this loop is running eight times.
So in total, I will be able to print I starts.
I am repeating myself, each time this loop is running, I will print star and this loop is running
eight times, so I will be able to print I starts.
And how will I run this loop by at times with the help of these three blogs.
I will be able to run this loop eight times.
So let does the the flowchart.
So I will start my flow chart.
Then I will read an.
And then I have to print Ando's, so I will use a variable play, which is initialized to one.
Then I will check the condition is I.
Less than articles to end.
Now, if this condition is true.
If this condition is true, that means I'm inside this loop and inside this loop.
Each time I have to print a rule and we have discussed that for printing a rule, I need a loop.
And this loop will run eight times.
OK.
So for running the loop, I at times I am using a variable G which is initialized to one, then I will
check is g less than or it goes to a.
Now, if this condition is true, I have to print stutt.
Jay, it goes deep, less than.
And then check the condition again.
OK.
So this loop is running eight times and each time I am printing, I start.
So in total, this loop will print.
I starts.
And if this condition is false.
So if this condition is false, that means I have printed Windrow.
Now I have to go to next to line.
So Brent backslash.
And so this is a command for going to next line.
And then I will increase the value of fire by one.
And then I will check the condition again.
So why I'm writing this statement.
If you look carefully after printing this rule, I have to go to next line.
Similarly, after printing this rule, go to next plane.
After printing this rule, I have to go to next line.
So this loop is printing VENDEL.
And after printing this rule, I have to go to next line.
That's why I'm using this statement.
And then I will say, listen.
And then I will check the condition again.
So this loop is running eight times and each time I am printing, I start.
So in total, I will be able to print ice stars and my outlook is running and times and each time I
am printing.
So I will be able to print Ando's if this condition is false.
That means I have rendered all my end those and my work is over now.
So I will end my program.
OK, so let us understand this flowchart with the help of an example.
OK, so let's say the value of an is three start root and I equals one, so I equals one is one less
than I goes to three.
So the condition is true.
You will come here.
J equals one.
Okay.
J equals one.
Then he will check the condition is one less than Ocus to into the condition is true.
You will start August.
I am writing my output here.
So I am printing start increase the value of G.
By one to the new value of J is two.
And then you have to check the condition again.
So is to list.
Then I goes to one to the condition is false.
Windrow has been printed and you have to go to next plane, so I will come here next plane and you are
doing is the value if I buy one or the new value if I is to.
And then you will check the condition again is to list an order close to three.
So the condition is true.
You will come here J equals one.
OK.
Check the condition again is when Lester goes to do to the condition is true.
You will come here.
Brent, start okay.
Engage the value of the observance or the new value of JS to.
The condition, again, is to let them I what to do.
The condition is true.
Brent Astar.
Okay.
And give them a little gem Evans, when you live J.s three and then you have to check the condition
again.
So is three less than goes to do?
No.
The condition is void.
What will you do?
You will go to New Line.
OK.
Now I will come here.
Now what will you do?
You will increase the value if I buy one to the new value of AI is three.
So I equals three.
And then you will check the condition again.
So is three less than ogles to treat?
The condition is true.
You will come here J.
Question.
Okay.
J equals when.
Then I will check is one less than I goes to three.
Yes, the condition is true.
You will print Stata and gives the year by events when new value of JS to.
And then you have to check the condition again.
So is to list then articles close three.
Yes.
The condition is true.
You will start again and give them a live J by one.
So I live j.s three.
I will check the condition again.
So is t less than Noriko's to treat the condition is again through.
You will print one more stop.
Now will you increase their LFG by one.
So anyway, live J.
J will become four.
So is for less than was two three.
No, the condition is false.
So if the condition is false you will go to new line.
Okay.
Next line and you will increase the value of five.
So the new value of EI is four.
And then you will check the condition again.
So is for less than or equal to three.
No.
Four is not less than a cost to three.
So the condition is void.
You will reach here and you will end up program.
So my output is this.
Which is hundred percent correct for any quiz.
Three.
So let us revise what we have done.
So the problem statement was, I have to read and and we have to print the following button.
So if any equals to I am printing doodles if N equals five.
I am printing five floors.
And if and equals three, I am printing Titos.
So one thing is crystal clear here that I need a loop that will run end times because we have to print
those is the value of ministry.
This love will end two times if the value of this to this loop will burn two times if the value of Venezuela.
This look within five times and inside this loop I have to print double.
So each time I am branding arrow and outer loop is running end times.
So in total I will be able to print and lose.
So the first part of this problem is over.
Now the second part.
How to print a room?
Then I told you.
If we look carefully here, if I is three.
So if the value of history I'm printing three stars, if the value of AI is two and printing to start.
If the value of AI is when I am printing just one star.
That means I need a loop and this loop will run eight times.
And inside this loop each time I will print star.
So each time I am printing a star and the outer loop is running eight times.
So in total I would be able to print isobars.
And how will I run this loop by four times with the help of these three blogs, I will be able to run
this loop eight times.
And for running the loop end times, I will use a variable eye.
And with the help of these three blogs, I will be able to run this loop.
And times.
And this is our very simple flu, Jack.
So let's take another example to understand this flowchart.
So let's say and it goes to.
So you start read and I equals one.
So I equals one.
So is.
One less than I got to do for the condition is true, you will come here.
Then Jaquiss one against a Jaquiss one you will check the condition is one less than Agosta.
When the condition is true, we will bring it to start.
OK.
So I am printing stuff and then you will increase the value of J by one.
So the new value of J will become do.
And then you will check the condition again.
So is two less than articles two also the condition is false.
I have printed when I'm Tyrel I have to go to a new line, so I will go to next line.
So now you will increase the value of five.
I want to show the new value of I is two and then I will check the condition again is to list Anglo's
to two for the condition is true j.s again one then you will check the condition again.
So is one less than I goes to.
When the condition is true, you will again being tested and then you will increase the value of J by
one to the new valy of J will become do.
Then you will change the condition again and the condition will again be true.
You will print against that and you will engage the role of thereby once when you will, you will become
three and you have printed this entire drawer and then you will go to a new line.
You will engage the earlier five events of the new value of I will become three.
And similarly, this condition will become false.
And then you will enter program and the output will be this, which is under percent correct for N equals
two.
So this problem requires use of two loops, one loop inside and the loop.
So this inner loop is running eight times and each time I am printing, I start.
So in total I am printing Istar Sarah.
OK.
And the outer loop.
Is running and times and each time I am printing Vendel.
So in total I will be able to print Androes.
So I hope you have understood this problem.
We will be printing many such patterns in our future lessons.
So this problem should be crystal clear in your mind.
That is why we need to lose here how this loops are working.
So my advice to you is take out your pen and paper and try to do the flowchart on your own.
Take few different values often and try to understand how this loops are working.
So finally, congratulations on finishing all the six problems.
You have done a great job.
So if you have any doubt in any question, feel free to ask.
In the next class, we will learn pseudocode.
Pseudo.
Called the next class will be focused on pseudocode.
So I hope you enjoyed today's tutorial.
I will tune an extra story.
Till then, enjoy C++.