Hey, guys, what's up?
So today we are going to solve one more interesting problem, one more PADDON printing problem.
So the rebels treatment is given and we have to print the falling pattern.
So given then we have to print.
We have to rent a falling pattern, so for any equals five.
My pattern will be something like.
So if you remember, we have already sold this type of problem and flowcharts or I think in some locals.
So the logic was very simple here.
The Valley of Fire is one here, the valley of fire is to the valley of phase three.
The valley of high is full and the valley VLDL, phase five.
So one thing is very clear.
If the veil of and it's five, I have to print five arrows.
OK.
So I need an outer loop and this loop will run and times.
So and time's outer loop.
And first of all, I have to print spaces.
So how I mean, it's.
I have to print.
And minus I space's.
OK, then I have to print values.
Then I have to print values and how many will lose?
I have to print.
So I have to print the way minus one values.
I have to print.
You can see here.
I have to print to I minus.
When we lose the value of I is three.
So two and two.
Three minus one.
That is five.
So I have to print five.
Raila's.
OK, so first I will print and minus ibises and then I will print Douai, minus one may lose starting.
From one.
So I have to bring it to a minus when we lose, starting from one.
And then after printing the entire rule, what I will do, I have to will do next line.
So she yelled and line.
Now this go to next line.
So this is our logic.
OK.
So let us implement and C++.
So let us name this file as number by 10.
So a number.
Burton.
So what I have to do, I will first take and as input fundi, use it then since we have to print Androes,
I need a loop and this loop children and times.
So in Dich was when.
While I is less than or equal to n
I blessed, blessed.
So this loop will run and times and each time this loop is running.
I have to print a year through.
Okay.
And for printing I year through.
This is my logic.
So this logic is for printing.
Yet a rule.
So first of all I have to print and minus I spaces.
So I need a lube and this loop should run and minus one times.
Okay.
So let's do it.
So I need a loop that will run and minus one times.
So that us take a variable and count equals one.
And how many times.
And children and minus eight times.
So while ground is less than articles two and minus I.
So this loop is learning and minus times, and each time this loop is running.
I have to print spaces, so I have to print spaces.
So now I have printed special.
What I have to do now, now I have to print values.
I have to print values starting from one.
So how many values I have to print?
I have to print the way minus one may lose.
That means I need a lube and this lube children to a minus one times.
OK.
So this look, children do y minus one times.
And also I will need a variable.
Let's call it value initially.
Well it will be one.
And value will be incremented.
At each step.
OK.
Why my values initially when?
Because you can see here.
I have to start printing from one and then I really incremental I.
Because then I have to print two.
Then three.
Then again, two and three and four.
And then five.
And how many values do I minus one values.
So I need to do that.
QUILLIAN do I minus one times.
OK, cool.
So.
I need a loop.
So let's call it J.
So into J equals one.
And I need a value.
So initially value it equals one because I had to start printing from one.
So how many times this loop should run?
So this loop children the way minus one times.
So the A minus one.
G best.
So this loop will run the way minus one times and each time this loop is running.
What I have to do, I have to seek out value.
And also I have to increment value.
Because next time.
Because next time after I will do a loop under after two to live enter.
Okay.
So I have to incrementally value also.
Now at this point of time I have printed I yet through Vendel has been printed completely.
So I will go to next line and we're going to next line.
We will write C out and line.
But this is the complete logic.
You can see the gold.
OK, so let us test our program for different values of an.
So here is there is an error.
OK.
So it will be Duplass best and then semicolon.
OK, now let us run our program.
Suppose the value of end is three.
So output is correct.
Now, I suppose they're really off.
And is.
Five.
So output is correct.
OK.
You can see the gaudier.
So first of all, our logic was I have to print Androes.
So this look I equals one, I less than less to win and I plus plus this with the help of these three,
my local children and dimes, because we have to print Ando's.
Then we have decided that we will print and minus I species.
So canticles one countless dingo's to end minus eight and count plus plus.
So this loop will go on and minus eight times and each time I am printing Speace correct.
After that, we decided that we have to print the way, we have to print the way minus one values.
So I need a loop there to learn the way minus one times.
So in the Jaquiss one J less tangles to do a minus one and G plus plus.
So at Delp of these three this loop will run the way minus one times and we have decided that we will
start printing Relu starting from one, then two, then three and so on.
So for that reinitialize to a variable value which is initially one and each time we are printing this
value and each time we had incrementing the value by one and after printing the entire rule, I will
go to the next line.
So see out and Lane.
So this is the complete logic.
OK, so this problem was easy.
So this is it for this video.
Thanks for watching.