OK, so let us solve one more interesting problem.
Problem number four.
So this is going to be the last problem of today's class.
So the problem statement is.
I read in and print.
Falling pattern.
Brent falling.
So if and it goes t my pattern is one, two, three, two.
Three, four, five, four, three.
Similarly, if the really off.
And is five my baton.
One, two, three, two, three, four, five, four, three, four, five, six, seven, six, five,
four, five, six, seven, eight, nine, eight, seven, six, five.
OK, so how we can solve this problem?
So the problem of treatment is I have to read and.
And we have to prevent the falling, but then so the value of honesty.
I am printing Titos.
Similarly, if the value of end is five, I am printing five, it was.
So one thing is crystal clear here that I need a loop and this loop will run and times.
Because we have to print Ando's.
If the value of any story this low vildan two times the value of Ennis is five, this look within five
times.
OK, so how will this Lupron end times?
What I will do, I will use a variable.
I initially I equals when I left in order to win and I was a plus one.
So with the help of these t my luck will run and times.
OK, so each time this loop is learning what I will do, I will print Dettol.
Ben.
So here you can see I am having space's.
Similarly, here I am also having spaces.
Okay.
So how can I bring Daryl?
First of all, I will print spaces, then I will print numbers.
OK, so here's the value of I is one here, the value of AI is two.
And here the value of AI is three.
Similarly here, the value of FI is one.
Here the value of fight is two and so on.
Here, the value of AI is five.
So footprinting idol.
First of all, I will print spaces.
So how many speeches I have to print?
I have to print and minus eyepieces.
You can see here led to the value of and is T and I quote T.
S, I mean, it's Biscet, I will print, I will print and minus face basis debtors' three, minus three.
Now this zeros PCs.
You can see here I am printing zero species.
Okay, let's take one more example.
Suppose and equals five and I equals four.
So how many spaces I will print.
I will print four minus one that this one space.
You can see here and equals five and I equals four.
So I am printing just one space.
OK.
So after printing spaces I have to print the numbers.
If you will look carefully, first, I have to print increasing number.
And then I have to print decreasing number.
First I am printing increasing them.
Then I am printing decreasing numbers.
OK.
So in this first I have to print increasing numbers.
And then I have to print the closing numbers.
So how many are losing the must I have to print?
Here, the vilify is for slam printing, for increasing number.
Hey, the value of AI is three.
So I'm branding.
Think it in number.
Similarly here, the value of FI is to Sam branding to increasing number.
So I have to print.
I increasing numbers.
I have to print.
I encouraging numbers.
OK, so how many degrees in them.
But I have to print.
Hear the value of I is 23 and I am bringing food increasing number.
Here, the value of FI is five and I am printing for decreasing numbers.
Heather Valley of Fire is three and I am printing to releasing them was.
So how many accusing them, but I have to, Brent, I have to print a minus one because numbers.
OK.
So if we look carefully, so what is the first number that I will print?
OK, so let us revise what we have done below.
So our problem was I have to read and and we have to print the falling button.
First of all, we observed that if the value of honesty I am printing Titos, if the value of an is
five, I am printing five rolls.
So I need a loop and this loop children and times because we have to print and those.
And with the help of DST, my local children and times and each time this loop is running, what I will
do, I will print out all.
And for printing it all.
First I will print spaces martela many spaces I have to print.
I have to print and minus eight spaces.
Then I have to print numbers.
And the numbers here are of two types, increasing numbers.
And then I am having decreasing numbers, increasing numbers and then decreasing numbers.
So how many using numbers I have to print.
So I have to print.
I increasing numbers and how we integrating them.
But I have to print.
I will print I minus one because in numbers.
So if you look carefully, if the value of Y is for my first increasing number is four.
That is a.
If the value of fire is three, my first number is three, that is I if the value of fire is five.
My first in using them is five.
That is I.
So I have to print I increasing numbers starting.
From.
I.
And similarly, if the value of AI is three, what is my first book using number, my first or decreasing
number is four.
Is the way minus two.
If the value of AI is to my foster, decreasing number is two, that is the way minus two.
And similarly, if the value of fire is five, my first decreasing number is eight, which is the way
minus two.
So I have to print a minus one using them.
But starting from.
The way.
Minus two.
OK.
So how will this Lupron and minus one times?
So I will use a variable space.
Initially, space equals one space less than articles to N minus A.
Space equals.
Space plus one.
So with the help of these three mile loop will run and minus one times.
And each time this loop is ending, what I will do, I will print space.
Similarly, this loop will run eight times.
So I will use a variable count.
So initially counterclaims when.
Count less than or close to a.
And count equals count plus one.
So with the help of these three, my loaf will run eight times.
So this loop will run eight times.
And each time this loop reasoning.
What will I do?
I will print a No.
And then I will increase the value of number by one to number equals number.
Plus one, because we have to print increasing numbers.
And what is the first number that they will print?
So the first man murdered I will print will be I.
Okay, similarly, I have to print.
I am minus one because in No.
I will use a variable initially gone into question.
Count less than I was to I minus one and count equals count plus one.
So with the help of these three in my Leupp will then I minus one times.
OK, so each time this loop is running, what I will do, I will print a number.
And then I will decrease the value of number by one.
So, no, it was number minus one because we have to print the closing numbers.
And what will be the first number that I will print?
So the first number that I will print will be the way minus two.
OK.
So in total, I will be using for Lupe's.
So this is the loop that we run and times because I have to print Ando's, then I am having loop number
one.
So this loop will print spaces.
Then I am having Lou Palumbo, too.
So this loop will print increasing numbers.
Then I am having lube number three and this loop will print the closing numbers.
And now I have printed one in battle.
What will I do?
I will go to NextRadio, so print backslash and to go to next line or next RU.
So I am using for loops.
When is outer loop and other area in the loop?
So one out the loop and t inner loop.
OK, so let us right, this will look good.
So if Dede and.
I equis, when.
While I less than ordered close to N do.
So this is my outlook.
So what will I do here?
First of all, I will print spaces, space.
Equals one way.
Space is less than I was to.
So how many spaces I have to print?
I have to print and minus eight spaces.
Do we're too late to print space?
Space equals space.
Plus, when.
OK.
Now, I have printed spitters.
So what is the next step?
I will Brint I increasing numbers.
You can see here.
I have to print I increasing numbers starting from a.
No, initially equals two I and going this one.
So how many is in the mess I have to print.
So I have to print I increasing numbers.
So while.
Ground is less than I am close to.
I don't.
What do they do here?
I will spend.
No.
No equals no plus one, because I have to print increasing numbers and count.
It was.
God bless.
When?
Okay, so I have branded increasing numbers.
Now my next step is to print necklacing numbers.
So I have to print I minus one, because in numbers starting from the way minus two.
So Nam equals.
The way minus two and count equals one.
While.
Count is less than or equal to a minus one because I have to print a minus one numbers.
What would I do?
I will print no.
And then I will decrease the number by one because I have to print decreasing numbers.
Count it, Gwynn's.
Count plus one.
Now, I have printed an entire issue.
I have to go to next to do so print.
Backslash.
And here I am having I equals I plus one.
And here I am, having made a dumb statement.
OK, so this is my complete pseudocode.
So let us revise again.
So I have to read and and we have to bring the fulling by then.
So the value of an Estie.
I will print Titos if the value of minus five.
I will print Faithful's.
Okay.
So I need a loop and this loop vildan and James.
So here you can see so here I am, I being I equals when I left and I goes to N.
So here I am having I equals one.
Here I am.
I left and goes to N.
And here I am having this statement.
So this loop will then end times.
OK, so the first problem is Zoet.
And now each time this loop is ending, I will print Adul so footprinting to.
First, I need to print the spaces, how many spaces and minus ice bases.
OK.
So spaces equals one spaces less than there was two and minus eight.
And spaces equals business plus one.
So with the help of these three, this loop will run and minus eight times and each time this loop is
ending.
I am branding spaces.
OK.
Now I have to print I increasing numbers, okay, and starting from I.
So I have to print.
I think losing them was starting from a.
So count equals one count less than close to a count, of course, count plus one.
So with the help of these three, my love will run eight times and each time this loop is ending, I
am printing a number and I am incrementing the value of number by one.
And initially, my number is.
I saw the first number and I will print will be a.
Now I have to print the closing numbers.
How many accusing them as a minus one, accusing them was starting from the way minus two.
So count to close one count less than it was two, a minus one.
And canticles count plus one.
So with the help of these three, this loop will run I minus one times.
And each time this loop is ending, I am printing an amber and I'm documenting the value of no by one
because I have to print the closing number and the first number that I will print will be the way minus
two.
And now we have printed an entire row.
What will I do?
I will go to next plane and after printing and lose this loop will break.
I will come out of this loop and it will hit written statements or written myths and.
So after printing Ando's.
It does create it will be executed and I will end my program.
OK, so let's take an example to get a better idea how this little is looking, for example, into the
value of fairness, do so virtually my output, my output should be one, two, three, two.
OK, so let's see whether this sort of code is giving me the right output or not.
So, dude.
And then I equals one.
So I equals one.
Now check the condition is one less than I got to do.
So the condition is to go inside the loop.
Space equals one.
OK, so a space.
Equals one.
No, Jack, the condition is one less than it was two and minus.
OK, so what is the value of N minus?
So N minus eight equals two, minus one, which is one.
OK, so now, Jack, the condition is one less.
The Noriko's to one through the condition is to go inside the loop print space.
So I am writing my output here.
OK.
So I have to print space.
OK.
It gives her a little space by one to a new value of spaces to.
Now watching the condition again.
Is to less than ocus to one.
The condition is false.
You will reach here.
No equals.
I see no equals one count equals one.
OK.
So count equals one.
I'll check the condition is, well, less than articles to win.
So the condition is true.
You will go inside the loop.
Brenda No.
OK.
Is there enough number by one?
It gives them a going to buy one.
Check the condition again is to less than August two one.
No, the condition is false because two is not less than articles to one.
So my condition is false.
I will come out of this loop and I will reach here.
No, it goes to a minus two.
OK, so a number equals the way.
What is the value of a one minus two, which is zero.
OK, guarantee close one count equals one.
Now, check the condition of get first of all, what is the value of a minus on the value of eye witness
on this one minus one, that is zero.
Now, check the condition is one less than Agosta zero.
No, the condition is false.
One is not less than or equal to zero.
The condition is false.
You will not go inside this loop.
You will likely come here.
Backslash that does go to next lane.
So I will reach you.
I was a plus when.
So the new Aleo fight is to.
OK.
Let me clear all this.
OK, so in is there a little fire by went to the Newble, your fire is to say I'm writing here.
I was to check the condition is to less than I was to do.
So the condition is to go inside the loop.
Now, what is really often minus a so and minus eight equals two minus two, which is zero logic.
The condition is one less than Agosta zero.
Nor the condition is false.
You will not go inside this loop.
You will likely come here.
Okay.
So you will not go inside this loop.
You will likely come here.
No, because I saw a number.
It goes to.
Counterclaims equation against So Count.
Equals one.
Jake, the condition is, well, less than it was to do so, the condition is to go inside the loop
print.
No.
Where does they live?
Number two.
So I will print two.
And give them a lesson number by went to a new value.
Number is three.
It gives a really off guard by when?
Now, check the condition again is to list in August, tattoos with the condition is to go inside the
loop current number.
Where does the live number three?
So I will print three.
In case there are enough number by one to any well off number is full.
And gives them enough.
Can't buy one.
This tree.
Now, Jack, the condition again is still less than it was to do so is three less than already, close
to two known?
The condition is false.
You will not go inside this loop.
You will come here, OK?
So, no, it goes to a minus two.
So a number equals two.
I do, though, if I do minus two.
So number equals to count equals one.
OK, so count equals one.
Wild card in less than a year goes to a minus one.
So what is the value of five minus one to minus one, which is one?
OK, so now, Jack, the condition is one less.
It goes to one.
The condition is to go inside the loop, print the number.
What is the role of number two?
So I will print two here.
They gave their ayliffe number by one.
So number is one, it gives them I love can't buy one.
So neurally of counties to now check the condition again is to less than Agosta, one is to less than
oil.
Close to one.
No.
The condition is for it.
You will not go inside this loop and you will reach here.
OK.
Go to next lane.
So I will reach here.
And give them a little fire by events when you when your fly is three.
And now you will check the condition again.
Is three less than our to do is to less than I was to do?
No.
So you will not go inside the loop and you will reach here.
Here I am, having written statement like this and doing a program, and this is my output.
Which is hundred percent correct.
So I hope you understood this problem.
This is the toughest problem we have solved till now.
And my suggestion to you is take out your pen and paper, try to understand.
Problem big the problem in two different parts and similar to all those parts.
Try to write to the code on your own.
Take different values often and run your pseudo code and see whether years or record is right or wrong.
OK, so I hope you understood this problem.
So if you have any doubt in any equation that we'll go.
Below.
Feel free to ask.
So before turning this class, I want to discuss one more thing that I should have discussed before.
So what is pseudocode?
What is sort of called so subtle means false and rare disorder called sort of God is not an actual code,
but it is very similar to an actual code that will be writing in C++.
Finally, congratulations.
On finishing all the flight problems, you have done a good job.
So in the next class, we will learn about numbly system.
Next class will be focused on.
No system.
And in my system, our prime focus will be on by binary.
And Investment Lummus system.
So I hope you enjoyed today's tutorial.
I will see you in the next one.
Till then, enjoy C++.