rishabh11336 / PatternPrinting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PatternPrinting

Part-1

Q1. Print the following pattern for the given N number of rows.

Pattern for N = 4

4444
4444
4444
4444

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Constraints

0 <= N <= 50

Sample Input 1:

7

Sample Output 1:

7777777
7777777
7777777
7777777
7777777
7777777
7777777

Sample Input 1:

6

Sample Output 1:

666666
666666
666666
666666
666666
666666

Q2. Code : Triangular Star Pattern

Send Feedback Print the following pattern for the given N number of rows. Pattern for N = 4

*
**
***
****

Note : There are no spaces between the stars (*). Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Constraints

0 <= N <= 50

Sample Input 1:

5

Sample Output 1:

*
**
***
****
*****

Sample Input 2:

6

Sample Output 2:

*
**
***
****
*****
******

Q3. Code : Triangle Number Pattern

Send Feedback Print the following pattern for the given N number of rows. Pattern for N = 4

1
22
333
4444

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Constraints

0 <= N <= 50

Sample Input 1:

5

Sample Output 1:

1
22
333
4444
55555

Sample Input 2:

6

Sample Output 2:

1
22
333
4444
55555
666666

Q4. Code : Reverse Number Pattern

Send Feedback Print the following pattern for the given N number of rows. Pattern for N = 4

1
21
321
4321

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Constraints

0 <= N <= 50

Sample Input 1:

5

Sample Output 1:

1
21
321
4321
54321

Sample Input 2:

6

Sample Output 2:

1
21
321
4321
54321
654321

Q5. Code : Character Pattern

Send Feedback Print the following pattern for the given N number of rows. Pattern for N = 4

A
BC
CDE
DEFG

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Constraints

0 <= N <= 13

Sample Input 1:

5

Sample Output 1:

A
BC
CDE
DEFG
EFGHI

Sample Input 2:

6

Sample Output 2:

A
BC
CDE
DEFG
EFGHI
FGHIJK

Q6. Code : Interesting Alphabets

Send Feedback Print the following pattern for the given number of rows. Pattern for N = 5

E
DE
CDE
BCDE
ABCDE

Input format :

N (Total no. of rows)

Output format :

Pattern in N lines

Constraints

0 <= N <= 26

Sample Input 1:

8

Sample Output 1:

H
GH
FGH
EFGH
DEFGH
CDEFGH
BCDEFGH
ABCDEFGH

Sample Input 2:

7

Sample Output 2:

G
FG
EFG
DEFG
CDEFG
BCDEFG
ABCDEFG

Q7. Number Pattern 1

Send Feedback Print the following pattern for the given N number of rows. Pattern for N = 4

1
11
111
1111

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Sample Input :

5

Sample Output :

1
11
111
1111
11111

Q8. Number Pattern 2

Send Feedback Print the following pattern for the given N number of rows. Pattern for N = 4

1
11
202
3003

Input format :

Integer N (Total no. of rows)

Constraints:

1 <= n <= 50

Output format :

Pattern in N lines

Sample Input :

5

Sample Output :

1
11
202
3003
40004

Q9. Number Pattern 3

Send Feedback Print the following pattern for the given N number of rows. Pattern for N = 4

1
11
121
1221

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Sample Input :

5

Sample Output :

1
11
121
1221
12221

Q10. Number Pattern

Send Feedback Print the following pattern for the given N number of rows. Pattern for N = 4

1234
123
12
1

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Sample Input :

5

Sample Output :

12345
1234
123
12
1

Q11. Alpha Pattern

Send Feedback Print the following pattern for the given N number of rows. Pattern for N = 3

A
BB
CCC

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Constraints

0 <= N <= 26

Sample Input 1:

7

Sample Output 1:

A
BB
CCC
DDDD
EEEEE
FFFFFF
GGGGGGG

Sample Input 2:

6

Sample Output 2:

A
BB
CCC
DDDD
EEEEE
FFFFFF

Part-2

Q1. Code : Inverted Number Pattern

Send Feedback Print the following pattern for the given N number of rows. Pattern for N = 4

4444
333
22
1

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Constraints :

0 <= N <= 50

Sample Input 1:

5

Sample Output 1:

55555 
4444
333
22
1

Sample Input 2:

6

Sample Output 2:

666666
55555 
4444
333
22
1

Q2. Code : Mirror Number Pattern

Send Feedback Print the following pattern for the given N number of rows. Pattern for N = 4

...1
..12
.123
1234

The dots represent spaces.

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Constraints

0 <= N <= 50

Sample Input 1:

3

Sample Output 1:

  1 
 12
123

Sample Input 2:

4

Sample Output 2:

   1 
  12
 123
1234

Q3. Code : Star Pattern

Send Feedback Print the following pattern Pattern for N = 4

...*
..***
.*****
*******

The dots represent spaces.

Input Format :

N (Total no. of rows)

Output Format :

Pattern in N lines

Constraints :

0 <= N <= 50

Sample Input 1 :

3

Sample Output 1 :

   *
  *** 
 *****

Sample Input 2 :

4

Sample Output 2 :

    *
   *** 
  *****
 *******

Q4. Code : Triangle of Numbers

Send Feedback Print the following pattern for the given number of rows. Pattern for N = 4

...1
..232
.34543
4567654

The dots represent spaces.

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Constraints :

0 <= N <= 50

Sample Input 1:

5

Sample Output 1:

    1
   232
  34543
 4567654
567898765

Sample Input 2:

4

Sample Output 2:

   1
  232
 34543
4567654

Q5. Code : Diamond of stars

Send Feedback Print the following pattern for the given number of rows. Note: N is always odd. Pattern for N = 5

..*
.***
*****
.***
..*

The dots represent spaces.

Input format :

N (Total no. of rows and can only be odd)

Output format :

Pattern in N lines

Constraints :

1 <= N <= 49

Sample Input 1:

5

Sample Output 1:

  *
 ***
*****
 ***
  *

Sample Input 2:

3

Sample Output 2:

  *
 ***
  *

Q6. Number Pattern

Send Feedback Print the following pattern for n number of rows. Note: each line consist of equal number of characters + spaces. Suppose you are printing xth line for N=n. You need to print 1..x followed by (n-x) spaces, again (n-x) spaces followed by x..1 For eg. N = 5

1        1
12      21
123    321
1234  4321
1234554321

Sample Input 1 :

4

Sample Output 1 :

1      1
12    21
123  321
12344321

Q7. Zeros and Stars Pattern

Send Feedback Print the following pattern Pattern for N = 4

*000*000*
0*00*00*0
00*0*0*00
000***000

Input Format :

N (Total no. of rows)

Output Format :

Pattern in N lines

Sample Input 1 :

3

Sample Output 1 :

*00*00*
0*0*0*0
00***00

Sample Input 2 :

5

Sample Output 2 :

*0000*0000*
0*000*000*0
00*00*00*00
000*0*0*000
0000***0000

Q8. Pyramid Number Pattern

Send Feedback Print the following pattern for the given number of rows. Pattern for N = 4

   1
  212
 32123
4321234

Input format : N (Total no. of rows)

Output format : Pattern in N lines

Sample Input :

5

Sample Output :

    1
   212
  32123
 4321234
543212345

Q9. Arrow pattern

Send Feedback Print the following pattern for the given number of rows. Assume N is always odd. Note : There is space after every star. Pattern for N = 7

*
 * *
   * * *
     * * * *
   * * *
 * *
*

Input format :

Integer N (Total no. of rows)

Output format :

Pattern in N lines

Sample Input :

11

Sample Output :

*
 * *
   * * *
     * * * *
       * * * * *
         * * * * * *
       * * * * *
     * * * *
   * * *
 * *
*

About


Languages

Language:Python 100.0%