/patterns

A collection of coding patterns for beginners and learners

Primary LanguageJavaMIT LicenseMIT

Patterns

I have a dream. 
I have a dream that anyone in the world who is stuck in any kind of pattern 
will get help from this repository.
Dear people of the world, please have a look at the patterns given below 
and write code to print that pattern after taking input from the user.
Each folder in this repository contains codes of corresponding patterns.

Please write code to whichever language you know and make them available for learners.

Please add more patterns if you like.

The Repository now contains code of the patterns in the languages: C, C++, Python, Java, Matlab, Ruby


The following patterns should be printed when the user input is "5":

Q1)
 *****
 ****
 ***
 **
 *
Q2)  
*****  
 ****  
  ***  
   **  
    *  
Q3)  
*  
**  
***  
****  
*****  
Q4)  
    *  
   **  
  ***  
 ****  
*****  
Q5)  
*********  
 *******  
  *****  
   ***  
    * 
Q6)  
    *  
   ***  
  *****  
 *******  
********* 
Q7)  
*  
**  
***  
****  
*****  
****  
***  
**  
*  
Q8)  
    *  
   **  
  ***  
 ****  
*****  
 ****  
  ***  
   **  
    *   
Q9)  
    *  
   ***  
  *****  
   ***  
    *  
Q10)  
*****  
*   *  
*   *  
*   *  
*****  
Q11)  
    1
   1 2
  1 2 3 
 1 2 3 4
1 2 3 4 5
Q12)  
1 2 3 4 5
 1 2 3 4
  1 2 3 
   1 2
    1 
Q13)  
        1
      1 2 1
    1 2 3 2 1
  1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1 
Q14)
***** *****
****   ****
***     ***
**       **
*         *

*         *
**       **
***     ***
****   ****
***** *****
Q15)
**********
 ********
  ******
   ****
    **
    **
   ****
  ******
 ********
**********  
Q16)
*****
****
***
**
*
**
***
****
*****
Q17)
*****
** **
* * *
** **
*****
Q18)
*.*.*
.*.*.
*.*.*
.*.*.
*.*.*
Q19)
    *  *
   **  **
  ***  ***
 ****  ****
*****  ***** 
Q20)
*
 ***
  *****
   *******
    ********* 
Q22)
0 1 2 3 4
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
Q23)
1 1 1 1 1
1 1 2 1 1
1 2 3 2 1
2 3 4 3 2
3 4 5 4 3 
Q24)
 _  _
/ \/ \
\    /
 \  /
  \/
Q25)
5 5 5 5 5
5 4 4 4 4
5 4 3 3 3
5 4 3 2 2
5 4 3 2 1 
Q26)
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5 
Q27)
1 
1 1
1 2 1
1 2 3 1
1 2 3 4 1
Q28)
1
2 3 
4 5 6 
7 8 9 10
11 12 13 14 15
Q29)
1 
2 3 4 
5 6 7 8 9 
10 11 12 13 14 15 16 
17 18 19 20 21 22 23 24 25
Q30)
****************
*******__*******
******____******
*****______*****
****________****  
Q31)
0  
0  1  
0  2  4  
0  3  6   9
0  4  8   12  16
Q32)
    $    
   @@@   
  $$$$$  
 ******* 
*********

Note: Use random characters from "$", "*", "@", "#", "%" to print every row.

Q33)
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25  
Q34)
--------e--------
------e-d-e------
----e-d-c-d-e----
--e-d-c-b-c-d-e--
e-d-c-b-a-b-c-d-e
--e-d-c-b-c-d-e--
----e-d-c-d-e----
------e-d-e------
--------e-------- 
Q35)
5 5 5 5 5 5 5 5 5 
5 4 4 4 4 4 4 4 5 
5 4 3 3 3 3 3 4 5 
5 4 3 2 2 2 3 4 5 
5 4 3 2 1 2 3 4 5 
5 4 3 2 2 2 3 4 5 
5 4 3 3 3 3 3 4 5 
5 4 4 4 4 4 4 4 5 
5 5 5 5 5 5 5 5 5
Q36)
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
Q37)
1 2 3 4 5 4 3 2 1 
  1 2 3 4 3 2 1 
    1 2 3 2 1 
      1 2 1 
        1 
Q38)
*
**
* *
*  *
*   *
******
 ++ your pattern

Project Maintainer

Profile Picture
Yash

💻