Pattern Printing Programming Questions and Solutions

In this article, We will discuss Symbol(star), Numeric, and Character(Alphabet) Pattern Program in C, Java, C++, and Python with Output.


Star Pattern Programs in C | C++ | Java | Python



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

2. Write a Program to print an inverted right triangle star pattern.


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


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

5. 
Write a Program to print the Full Pyramid Star pattern.


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

6. Write a Program to print an inverted pyramid star pattern.


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

7. Write a Program to print a square star pattern.

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

8. Write a Program to Print Half Diamond Star Pattern.

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

9. Write a program to Print a solid Diamond Star Pattern.


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

10. 
Write a program to Print Inverted V Star Pattern.

    *     
   * *    
  *   *   
 *     *  
*       *

11. Write a Program to print the Full Pyramid Star Pattern.
 
    *
   ***
  *****
 *******
*********

12. Write a Program to Print the Inverted Full Pyramid Star Pattern.

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

13. Write a  Program to print the Solid Inverted Half Diamond Star Pattern.

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

14. Write a Program to Print the V Star Pattern.

*       * 
 *     *  
  *   *   
   * *    
    *     

15. Write a Program to Print the Hollow Diamond Star Pattern.

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

16. Write a Program to Print the Pant's style Star Pattern.

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


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



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


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





Number Pattern Program in C | CPP | Java | Python


1. Write a program to print the 
rectangle Number pattern.

11111
22222
33333
44444
55555


2. Write a program to print the rectangle Number pattern.

12345
12345
12345
12345
12345


3. Write a program to print the rectangle Number pattern.

55555
44444
33333
22222
11111


4. Write a program to print the rectangle Number pattern.

54321
54321
54321
54321
54321


5. Write a Program to print the Half Pyramid Number Pattern.

1
22
333
4444
55555


6. Write a Program to print the Half Pyramid Number Pattern.

1
12
123
1234
12345


7. Write a Program to print the Half Pyramid Number Pattern.

11111
2222
333
44
5


8. Write a Program to print the Inverted Half Pyramid Number Pattern.

12345
 1234
  123
   12
    1

9. Write a Program to print the Full Pyramid Number Pattern.
      
    1
   222
  33333
 4444444
555555555


10. Write a Program to print the Full Pyramid Number Pattern.
   
    1
   333
  55555
 7777777
999999999


11. Write a Program to print the Full Pyramid Number Pattern.
        
    1
   123
  12345
 1234567
123456789

       
    1
   321
  54321
 7654321
987654321



    1 
   2 2
  3 3 3
 4 4 4 4
5 5 5 5 5



5 5 5 5 5 
 4 4 4 4
  3 3 3
   2 2
    1



    1 
   2 2
  3 3 3
 4 4 4 4
5 5 5 5 5
 4 4 4 4
  3 3 3
   2 2
    1



    1     
   2 2
  3   3
 4     4
5       5



5       5 
 4     4
  3   3
   2 2
    1


5
54
543
5432
54321
543210
54321
5432
543
54
5



     5
    45
   345
  2345
 12345
012345
 12345
  2345
   345
    45
     5



    1    
   2 2
  3   3
 4     4
5       5
 4     4
  3   3
   2 2
    1



1   1
 2 2
  3
 4 4
5   5



1 2
3 5 8
13 21 34 55
89 144 233 377 610



1     7
12   67
123 567
1234567
123 567
12   67
1     7



1    
22   
3 3  
4  4
55555


2 3
4 5 6
7 8 9 10
11 12 13 14 15

Alphabet Pattern Programs in C | C++ | Python | Java



1. Write a program to print the rectangle 
alphabet pattern.

A B C D E 
A B C D E
A B C D E
A B C D E
A B C D E


3. Write a program to print the rectangle 
alphabet pattern.

E E E E E 
D D D D D
C C C C C
B B B B B
A A A A A


4. Write a program to print the rectangle 
alphabet pattern.

E D C B A 
E D C B A
E D C B A
E D C B A
E D C B A


5. Write a program to print the Alphabet Half Pyramid Pattern.


B B
C C C
D D D D
E E E E E


6. Write a Program to print the right triangle Alphabet Pattern.

A B
A B C
A B C D
A B C D E


7. Write a program to print the Alphabet Inverted Half Pyramid Pattern.


E E E E E 
D D D D
C C C
B B
A


8. Write a program to print the Alphabet Inverted Half Pyramid Pattern.


A B C D E 
A B C D
A B C
A B
A


9. Write a program to print the Alphabet Inverted Half Pyramid Pattern.


A A A A A 
B B B B
C C C
D D
E


10. Write a program to print the Alphabet Inverted Half Pyramid Pattern.


E D C B A 
E D C B
E D C
E D
E

11. Write a program to print the Alphabet Inverted Half Pyramid Pattern.


      
    A
   BB
  CCC
 DDDD
EEEEE


12. Write a program to print the Alphabet Inverted Half Pyramid Pattern.


          
    A
   AB
  ABC
 ABCD
ABCDE


13. Write a program to print the Alphabet Inverted Half Pyramid Pattern.

ABCDE
 ABCD
  ABC
   AB
    A


14. Write a program to print the Alphabet Inverted Half Pyramid Pattern.

ABCDE
 ABCD
  ABC
   AB
    A



    A
   BBB
  CCCCC
 DDDDDDD
EEEEEEEEE



EEEEEEEEE
 DDDDDDD
  CCCCC
   BBB
    A



F
FE
FED
FEDC
FEDCB
FEDCBA
FEDCB
FEDC
FED
FE
F


     F
    EF
   DEF
  CDEF
 BCDEF
ABCDEF
 BCDEF
  CDEF
   DEF
    EF
     F


     A 
    B B
   C C C
  D D D D
 E E E E E
F F F F F F
 E E E E E
  D D D D
   C C C
    B B
     A



E       E 
 D     D
  C   C
   B B
    A  
   




















Post a Comment

38 Comments

  1. can you tell me this pattern
    1
    AB
    123
    ABCD
    12345
    ABCDEF
    in python ASAP!!!!

    ReplyDelete
    Replies
    1. size=int(input("Enter your size"))
      for out in range(1,size+1):
      for inn in range(1,out+1):
      if out%2==0:
      print(chr(inn+64),end="")
      else:
      print(inn,end"")
      print("\r")

      Delete
  2. how to print
    1 A A A A
    2 2 B B B
    3 3 3 C C
    4 4 4 4 D
    in java??

    ReplyDelete
    Replies
    1. n=int(input())
      num=1
      ch=str(input())
      for i in range(n):
      for i in range(i+1):
      print(num,end=' ')
      num+=1
      for i in range(0,n-i):
      print(ch,end=' ')
      d=ord(ch)
      d+=1
      ch=chr(d)
      print()

      Delete
    2. for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 5; j++) {
      if (i >= j) {
      System.out.print(i + 1 + " ");
      }else {
      System.out.print((char)(i+65)+" ");
      }
      }
      System.out.println();
      }

      Delete
  3. 4444
    3444
    2344
    1234
    can you do this in python

    ReplyDelete
    Replies
    1. k=4
      for i in range(4):
      p=k
      for j in range(i):
      print(p,end=" ")
      p=p+1
      k=k-1
      for j in range(i,4):
      print("4",end=" ")
      print()

      Delete
  4. #include

    int main()
    {
    int i, j, k;
    char ch;
    for(i=1; i<=6; i++)
    {
    ch='A';
    if(i%2!=0)
    {
    for(k=1; k<=i; k++)
    {
    printf("%d", k);
    }
    }
    else
    {
    for(j=1; j<=i; j++)
    {
    printf("%c", ch);
    ch++;
    }
    }
    printf("\n");
    }

    return 0;
    }

    ReplyDelete
  5. can u tell me pattern

    4444
    3444
    2344
    1234

    ReplyDelete
    Replies
    1. // 4444
      // 3444
      // 2344
      // 1234


      #include
      int main()
      {
      int limit=4, out, ins;

      for (out = 1; out <=limit; out++)
      {
      for (ins = 1; ins <= limit; ins++)
      {
      if(ins<out)
      printf("%d",limit+ins-out);
      else
      printf("%d",limit);
      }
      printf("\n");
      }
      return 0;
      }

      Delete
  6. Replies
    1. // 1
      // 21
      // 123
      // 4321
      // 12345

      #include
      int main()
      {
      int limit=5, out, ins;

      for (out = 1; out <=limit; out++)
      {
      for (ins = 1; ins <= out; ins++)
      {
      if(out%2==0)
      printf("%d",out-ins+1);
      else
      printf("%d",ins);
      }
      printf("\n");
      }
      return 0;
      }

      Delete
  7. how to print
    *+*+*
    +*+*+
    *+*+*
    +*+*+
    *+*+*

    ReplyDelete
    Replies
    1. // *+*+*
      // +*+*+
      // *+*+*
      // +*+*+
      // *+*+*

      #include
      int main()
      {
      int limit=5, out, ins;

      for (out = 1; out <=limit; out++)
      {
      for (ins = 1; ins <= limit; ins++)
      {
      if(out%2==0)
      {
      if(ins%2==0)
      printf("*");
      else
      printf("+");
      }
      else{
      if(ins%2==0)
      printf("+");
      else
      printf("*");
      }
      }
      printf("\n");
      }
      return 0;
      }

      Delete
  8. 1
    24
    135
    2468
    13579
    Can you please tell this pattern in c++?

    ReplyDelete
    Replies
    1. #include
      using namespace std;
      int main()
      {
      int in, out, pr;
      for (out = 1; out <= 5; out++)
      {
      if (out % 2 != 0)
      pr = 1;
      else
      pr = 2;

      for (in = 1; in <= out; in++)
      {
      cout <<pr<<" ";
      pr += 2;
      }
      cout << "\n";
      }
      }

      Delete
  9. Enter no of rows: 5
    Enter no of columns: 5
    Result:
    ABCDE
    F G
    H I
    J K
    LMNOP

    ReplyDelete
  10. 1
    AB
    123
    ABCD
    12345
    ABCDEF
    asap in java please !!

    ReplyDelete
    Replies
    1. public class P1 {
      public static void main(String[] args) {

      int in, out;
      for (out = 1; out <= 6; out++) {
      for (in = 1; in <= out; in++) {
      if (out % 2 != 0)
      System.out.print(in + " ");
      else
      System.out.print((char) (in + 64) + " ");
      }
      System.out.println();
      }

      }
      }

      Delete
  11. This comment has been removed by the author.

    ReplyDelete
  12. (a)
    (a + b)
    (a + b + c)
    (a + b + c + d)
    (a + b + c + d + e)
    (a + b + c + d + e + f)

    please print this in java asap!!

    ReplyDelete
    Replies
    1. for (int i = 0; i < 6; i++) {
      StringJoiner jn = new StringJoiner("+", "(", ")");
      for (int j = 0; j <= i; j++) {
      jn.add(""+(char) (97 + j));
      }
      System.out.println(jn);
      }

      Delete
  13. Write a program in C to display the following pattern

    1 2 3 4 5
    6 7 8 9
    10 11 12
    13

    ReplyDelete
  14. Write a python Program to print :-

    1
    1 0
    1 0 1
    1 0 1 0
    1 0 1 0 1

    ReplyDelete
    Replies
    1. for out in range(1,7):
      for inn in range(1,out):
      print(str(inn%2)+" ",end="")
      print()

      Delete
  15. print
    1
    2 A 2
    3 B B B 3
    4 C C C C C 4

    ReplyDelete
  16. *******
    b*****b
    bb***bb
    bbb*bbb
    How to print?

    ReplyDelete
  17. How to print

    1 3 6 10
    2 5 9 13
    4 8 12 15
    7 11 14 16

    in any language

    ReplyDelete
  18. how to print?
    4444
    4333
    4322
    4321
    (It was asked in zoho interview)

    ReplyDelete
  19. import java.util.Scanner;
    public class Main{
    public static void main(String [] args){

    Scanner scan=new Scanner(System.in);
    System.out.println("Enter the number of rows:=");
    int n=scan.nextInt();


    for(int i=n; i>=1; i--)
    {
    for(int j=n; j>=1; j--)
    {
    if(j>i)
    System.out.print(j);

    else
    System.out.print(i);
    }
    System.out.println();
    }
    }
    }

    ReplyDelete
  20. A
    11
    BBB
    2222
    CCCCC
    how to print this

    ReplyDelete
  21. How to print for n=5
    * * * * *
    . . . . *
    * * * . *
    * . . .*
    * * * * *

    ReplyDelete
  22. *
    * *
    * *
    * * *
    * * *


    please any one give me this answer

    ReplyDelete

Please do not Enter any spam link in the comment box