What is pattern printing? | How do I print a loop pattern?

 hi everyone welcome to coding idea

<image>

What is pattern printing?

this is 10 verse in the
last session we discussed write how to
print some other patterns right using
nested for-loops now in this session we
will see some more patterns okay now so
this is a pattern write how to print
this pattern using two loops but here it
is on conditions in an outer loop we are
using increment operator so as we have a

five rows so five times outer loop will
repeat I value starts with one so I is
less than or equals to Phi I plus plus
and inner loop four and what are the
inner loop conditions here it is I am
using decrement operator so decrement
means J equals to some value J is
greater than or equals to and J minus
minus decrement operator we are using
printf star and x1 printf slash in slash

this is Skelton we know and now here it
is what is the initialization and what
is the condition we need to check okay
to print this pattern here it is a five
stars we are printing here

I value starts with one starts with one
and here it is a J value in a decrement
order so J value starts with a five and
J is greater than or equals to I suppose
if you write like this

so initially I equals to 1 y equals 1
and J is always a starts with a 5 so 5
is greater than or equals to 1 so how
many times this loop will repeat 5 times
with the value 5 4 3 2 1 because in a
decreasing order
5 times it will repeat so 5 stars it
will print 5 stars next it will send the
control to next line in the same way in
the next iteration

How do I print a loop pattern

I value become too and the control move
inside so J value as usual five it
starts with a five but up to greater
than or equals to 2 only nothing but
with values 5 4 3 2 so 4 times it
repeats so four times it will print a
four stars in a second row four stars it
prints and next it will send the control
to next line so like that next I value
become three and again in the inner for
loop J value starts with a five five is

greater than or equals to three so with
the values five with a value for with
the value three three times it repeats
so here it is a three stars it will
print select that it will print this
pattern okay so instead of a star
instead of a star suppose I am printing
I value then what is the output in the
first iteration I equals to 1 and here
it is inner for loop repeats of Phi

times so 5 times 1 it prints 4 times 2
it will print because in a second case I
value 2 next I value 3 3 times X 2 times
a 4 and one time 5 it prints one time 5
it prints next here it is a j.j so what
is the J value so what it prints right
so what is the J value and what it
prints means suppose observe in the
first case J value starts with a 5 so
Phi 2 1 so 5 times so 5 4 3 2 1 in the
second iteration I value become 2 but J
value starts with a 5 if I 2 2 5 4 3 2
next I value become 3 so 5 4 3 next I
value become 4 so 5 4 next I value
become 5 only this much so this pattern
it will print so whenever we are
printing
value okay if you print stars so it will
print in this pattern we know that but
here this is a very important thing how
to print this pattern so means what the
background values writes in this
application what are the background J
values to print this pattern so that we
are printing directly J so 5 4 3 2 1 it

What is printed pattern?

will print so these are so for example
in this pattern so I am using in outer
loop I am using I - - and in the inner
loop I am using J plus plus so then how
to print this pattern and whenever we
are printing I value so what will be the
output whenever we are printing the J
value then what will be the output okay
see suppose in the outer loop I am using
decrement operator so I value starts

with a 5 I is greater than or equals to
1 I minus minus because it is fixed it
is fixed and in an inner for loop for so
J value this is a what is the
initialization what is the condition and
this is increment this is already fixed
in outer loop of - - in inner loop of
plus plus whenever we use a plus plus
operator is less than or equals to

condition whenever we use a minus - it
is a greater than or equals to condition
so definitely now so what is the initial
value and what is the condition alright
so remaining story as usual so we are
printing printf so we are printing the
start we are printing the star and next

one here it is a for loop just after
completion of inner loop we are just
sending the control to next line now
whenever I value is a 5 here we need to
print a 5 stars 5 stars we need to print
so here it is J value starts with a 1 J
is less than or equal to 5 now look at
this so J value always starts with 1 and
inner loop how many times it will repeat
means 1

How to print pattern

is less than or equals to I value is a
five with I equals to five it is coming
inside so one to five how many times it
will repeat five times it will repeat so
five stars it will print in a first row
in the inner for loop and once inner for
loop execution has been completed so

then it will print the slasher and next
it will continue with the outer loop so
now I will you become four again J value
restarts with a1 restarts with the one
but up to I a value is a four so how
many times it will execute with the
value one two three four so four
iterations so four stars it will print

one two three four and next write in an
outer loop I value become three so come
inside J value starts with a 1 so 1 2 a
value 3 only just 1 2 3 3 starts it will
print it next I value 2 so here it is it
will repeat only 2 times
next I value 1 it will repeat only one
time so 1 star it prints whenever outer
loop becomes 0

it will terminate so this is how we are
printing this pattern by using write a
minus minus in an outer loop and plus
plus inner inner loop so in this case
what are the patterns it will give
whenever we are printing I value and J
value which I value is very clear in
outer loop first I value starts with a 5
so 5 stars so instead of 5 stars

How do I print a loop pattern?

so 5 times it will print a file next in
the next iteration I value is a 4 so 4
it will print 2 4 times 3 it will print
the 3 times 2 it will print two times
and 1 it will print only one time and
next look at this this is important so
whenever we are printing J value so what
are the values it will print look at
this first J value starts with a 1 and
here it is up to 5 so nothing but 1 2 3
4 5 this one and next again second time
also J value starts to the 1 only and
here it is up to

What is pattern in C

I value so 4 1 2 3 4 1 2 3 1 2 N 1 so
this is a pattern it will print this is
important ok so whenever we are printing
I value and J value so these are the
patterns it will print right for this
pattern ok so this is how we are
printing right such type of patterns is
very easy okay

so in the next session we'll see some
more patterns right so based on four
loops writes for more articel

Post a Comment

0 Comments