0% found this document useful (0 votes)
21 views

Cone Shot Part 4

Uploaded by

ramanih989
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Cone Shot Part 4

Uploaded by

ramanih989
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Pattern Printing

Questions
****
****
****
Ques : Print the given pattern
S

***** No.
of lines -
*****
3

***** stars in each line + un

Nested Loops

Solid Rectangle
2

I
n = 5

Output
* &&&*&da&**&

·
printf("in");
3
S
** * * *

*****
3 no.
of lines = no.
of rows
&
No. of stars in each line = no. of columns
HW : Print the given pattern &
dry run

****
int n;
2

****
n
=

print
****
****

Solid Square
Ques : Print the given pattern
n Y
=

n = S

1234
↓ n
= 12 345

1234 123 12345

1234 123 12345

1234
123 12345
12345

Number Square
Ques : Print the given pattern
A

n Y
=

n = 2 n 3
=

*
↓ *
&

** & & **

*** ** &

**** 2
2

I 3&

y*&

Star Triangle
I
n = 3
3
Output
O
&

· & &

· && &
i x2 BY
=

=
5 xRX&B/ RB Y
Ques : Print the given pattern
Y
for (inti
=

n
=
1, i n;i+
= + (

**** -[intj:=
***
** In

*
->

3
n = Y
i+ j =

n+ 1
1 * U
⑨ j n +
=
1 -
i
2*& 3

2
3

Y I

Star Triangle Ulta


ANY
FERNS:
#

OR
aw
-

lines
1) No.
of

2) In each line what is


happening
Ques : Print the given pattern
n Y
=
n 2
=

1 I & 1 234

12
12 * 123Y
1234

123
& &
- 1234

1234 & &


a.

Number Triangle
HW : Print the given pattern
Hint

1234 & *

123 **

12 &

1 &

Number Triangle Ulta


Ques : Print the given pattern
n Y
=

1 135 7

13 I
7 35 7
I
1357

135 7 35 7

1357 1357

13579....in)

an 1
=
+ (n -

1.2+
Odd Number Triangle
Y

I
I & I

i A


I

I 3

i 113
=

j xpX35
=
n 3

I
=

Output
is ↑ 7
135
·
35

-79 11

a 13
=

,
ASCII
Ques : Print the given pattern
A
values

n 5
m U 3
=

n
=

ABCD B C A B C BE
A

ABCD
A B C BE
A B C

ABCD A B C BE
A B C

ABCD A B C BE

1234 A B C BE

- 234

1234

1234

Alphabet Square
123 A B C
A 65a 97
+
=

123 I A BC
B + 66

I 2 3 A B C C+ 67


656667

6566 67

6366 67
HW : Print the given pattern

A A BcB

AB *
B
A C B
a
Run
ABC A B C B

ABCD A- BCB

Alphabet Triangle
*HW : Print the given pattern
A

I 1 1 2 A B

AB
I 123 A B C
2
123 Y

123
A-BBcB
3 1234 S
ABC DE

ABCD
3 12345 else
& Number

Alphabet Triangle
Ques : Print the given pattern n 'odd'
123n 3 n 1
=

1234S
=

*
#
2
#

d
I #
#
I
# *
**

*
*

2#### 3#* #
3
*****
*
2
Y####

* #
#

5 ##

3
+1 z, +1 2+ 1
=

- =

Star Plus
j i =1; i <4; i+ +) i
for lint rows +

123 Y
1*** & L

I
2&*&& for (intj=1; i 14; i++) columnse;
S
is a

&&&
Printf("*");

y

printf('"\n");
3
HW : Print the given pattern
nevows me colum
123456
******
2
* *
3* *
******

Hollow Rectangle
Ques : Print the given pattern n is odd

1 2345 n S
=

* *
I

* * if (i j +1)
L
=
=
1i+j == n
Print("x");
3 * else
* *
print?" ");

* *
S

Star Cross
*Ques : Print the given pattern
n Y
=

n= 3
for (i =
1;i <n;i + +

1
I
&
23
for(i lijzi,j+ +)
G
=

23 456 E
· 6

456 )I
..6

6 006

7 8 9 10 S

*Homework ·
-

35

7 9 1

Floyd’s Triangle 13 15 17 19
*Ques : Print the given pattern
nY
=

I 2
3 Y
with 1

1 if (1%2! =
0)-start
I

01 elseestart with o
2

3 101
0101
-

0 & 1 Triangle
n Y
=

Output

I
&
I
-> start
· 0 1


I O I
->
switch
* 01 O I

a =
X00X & NO
n 5
=

I 2 3 u S

I Iv
it(i =
=
j & printf?"1");
O 20
if (i j
2
0) printf ("1");
%
+ 2 = =

3 O 20
I else printf ("O");
10 I O IU

-
1 0 I U 22
*Ques : Print the given pattern
123Y for (inti =
x

I
& If # # Y

**
# # K
for I
#

2## (
&X

***
#
# + I
#
3
E **

****
# 3
&& &
for ( -
I
3

Star Triangle Mast


1###* for (inti 1;=
i c
4;i+ + <
=

I
##*&
forlintj= jc n ijj+ +) S
2
1; =
-

i
*&&
&
3
#

Printf("#");
Y &***
3

for (intk=1; k< i; k+ + 1


tes
=

-R

I I oPanCHC"aT,T
i 1
=
I

i 2#+23Y
=

i 3# +15
= Y

iY = #-> Y - U

i +j n
=

Kni
HW : Print the given pattern

****
**** D: 1
----

****
- .

****
-

nsp 0;
=

nY
=

-nst n; =

... ***

-- - & usp + +;
I

- nst--;
--

** ---

Rhombus
HW : Print the given pattern

A &

AB &&

ABC
-S
***
***
ABCD
Y A
A B
ABC

A BC D

Alphabet Triangle
*Ques : Print the given pattern
i R n y =

&

*
Ip 1
&

***
. . .

2
2 **
*a

*****
- .
-

3 3xx

*******
-

**
Y
Y *&
&

int nst= 1;
1, 3, 5, 7n
3
nst nst
=
+
2;

-> an 1
=
+ (n 1).2s2n
-
-

1k =
1;kc n-
=
i

->
ai
=

2xi -

Star Pyramid
n 3
=

Output
3 B
*

· &

&
* & a *

nst X B5
=

i 12
=

j 21
=
*
...- x

2 **&
- -

3- ***

Y *****

int nsp =
3;

int nst=1;
HW : Print the given pattern
Clarity
1
123 123
12345 12345

1234567
1234567

Number Pyramid
*HW : Print the given pattern

A
ABC
ABCDE
ABCDE FG

Alphabet Pyramid
Ques : Print the given pattern
& &
*

L L I

1
R
I
-
- .
21 ↑
2
121 I 312321-
21

12321
-

321
-

3- Y 1234321

Y
1234321
& Homework -
-
- . . .
A

- - A BA

-
A B C B A

A 15 C B C B A

Number Pyramid Mast


**Ques : Print the given pattern n is odd
i n 7
of Costa st
=

Power

*
I

I
. . .

*** A &
2--
nsk-- - .

3 *****
-

& - *
nSt += 2

*******
& & a**&

*****
n 3 &d
5-
=

***
&
6

*
. . .

n = 5
7-- -

& I + yth line a middle line

middle line -
nsp = 0

nst n
=

Star Diamond
neno.
of lines =
5, md = 3

nsp= z =
PX81
1;BB3 Output

I
nst =


&

i I am
. .

·-
**&
a

-
ax ·
&&& &

S - - a
***
·-

a-- a

i 1
=
Ques : Print the given pattern

******* nst 3

*** ***
=

- -

usp 1
=

2
** **
- . . .

nsp 2

* *
+ =

3 . . . . . .

nst--

C * & &
~
*

&
. . .

* t
+
o - - . - -
a

Number Pyramid Mast


*Ques : Print the given pattern
I
234567n Y
1234567
=

I
n= 3

123 567
n 2
=

2 -
12345

3 12 67 -
. . .
123

3
12 -
45

1 7
1 -

...- 5
Y -
- - w
-

Number Pyramid Mast


3 I 123 567
-

nst B2
=

212--- 67 usp 13=

&
31-.--- 7

i 12=

a 11BMB6F8
=

Outpat
·
123 -
567
-12 -- -
67

2
*HW : Print the given pattern

ABCDEFG ⑭e
ABC EFG
AB FG
A G

Number Pyramid Mast


*HW : Print the given pattern
O
1234321 12 3 - 3 2 7

I
123 321 -
12 t
. . .
21
+

12 21
I
I . . . . .

2
. . .

3
1 -
1 -
- -

Number Pyramid Mast


**Ques : Print the given pattern
1234 5 67

4444444 Y
=

n
I

4333334
'2n-1' lines
2

3
4322234 33333
Y
4321234 32223
S
4322234 32123
6
4333334 3222
3

7
4444444 3333 3

Qn 3
=

Number Pyramid Mast


3 2 I 7 234
I 2 3 Y S 6
7j n u
=
I 1, ( 7
I 7 I I 1 I 11
1222
C
2
21
min
2
2 I 222 233
I

3
3:
13
2 3 33 21 I 23 Y
3 1
3 4321
Y -2

3 -1233321
4 - 1
i)
2612222 21j = 1234567

I 11 11
b 1234321
=

17 I 1

I
=1234567
a 1234
= 321

You might also like