├── NUMBER_INCREASE.JAVA ├── README.md ├── Rec.java ├── Square.class ├── h.java ├── pat1.java ├── pyradigam.java ├── pyradigram2.java └── tringle.java /NUMBER_INCREASE.JAVA: -------------------------------------------------------------------------------- 1 | // Java Program to print pattern 2 | // Number-increasing reverse pyramid 3 | import java.util.*; 4 | 5 | public class NUMBER_I9NCREASE { 6 | // Function to demonstrate pattern 7 | public static void printPattern(int n) 8 | { 9 | int i, j; 10 | // outer loop to handle number of rows 11 | for (i = n; i >= 1; i--) { 12 | // inner loop to handle number of columns 13 | for (j = 1; j <= i; j++) { 14 | // printing column values upto the row 15 | // value. 16 | System.out.print(j + " "); 17 | } 18 | 19 | // print new line for each row 20 | System.out.println(); 21 | } 22 | } 23 | 24 | // Driver Function 25 | public static void main(String args[]) 26 | { 27 | int n = 6; 28 | printPattern(n); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JAVA_Pattern -------------------------------------------------------------------------------- /Rec.java: -------------------------------------------------------------------------------- 1 | public class Rec { 2 | public static void main(String args[]) { 3 | int n = 10; 4 | for (int i = 0; i < n; i++) { 5 | for (int j = 0; j < n; j++) { 6 | if (i == j || i + j == n - 1) { 7 | System.out.print("*"); 8 | } else { 9 | System.out.print(""); 10 | } 11 | } 12 | System.out.println(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Square.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pappukumar35/JAVA_Pattern/0a5b0278bc3735750ff1355ef7732386613f622a/Square.class -------------------------------------------------------------------------------- /h.java: -------------------------------------------------------------------------------- 1 | public class h { 2 | public static void main(String args[]) { 3 | int n = 5; 4 | for (int i = 0; i < n; i++) { 5 | for (int j = 0; j < n; j++) { 6 | if (j == 0 || i == (n - 1) / 2 || j == n - 1) { 7 | System.out.print("P"); 8 | } else { 9 | System.out.print(""); 10 | 11 | } 12 | } 13 | System.out.println(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /pat1.java: -------------------------------------------------------------------------------- 1 | 2 | import java.util.*; 3 | 4 | public class pat1 { 5 | // Function to demonstrate pattern 6 | public static void printPattern(int n) { 7 | int i, j; 8 | // outer loop to handle number of rows 9 | for (i = 0; i < n; i++) { 10 | // inner loop to handle number of columns 11 | for (j = 0; j < n; j++) { 12 | // star will print only when it is in first 13 | // row or last row or first column or last 14 | // column 15 | if (i == 0 || j == 0 || i == n - 1 16 | || j == n - 1) { 17 | System.out.print("*"); 18 | } 19 | // otherwise print space only. 20 | else { 21 | System.out.print(" "); 22 | } 23 | } 24 | System.out.println(); 25 | } 26 | } 27 | 28 | // Driver Function 29 | public static void main(String args[]) { 30 | int n = 6; 31 | printPattern(n); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /pyradigam.java: -------------------------------------------------------------------------------- 1 | public class pyradigam { 2 | public static void main(String args[]) { 3 | 4 | int n = 6; 5 | for (int i = 0; i < n; i++) { 6 | for (int j = 0; j < n; j++) { 7 | System.out.print(j + " "); 8 | } 9 | System.out.println(" "); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pyradigram2.java: -------------------------------------------------------------------------------- 1 | 2 | // Java Program to print pattern 3 | // Number-increasing pyramid 4 | import java.util.*; 5 | 6 | public class pyradigram2 { 7 | // Function to demonstrate pattern 8 | public static void printPattern(int n) { 9 | int i, j; 10 | // outer loop to handle number of rows 11 | for (i = 1; i <= n; i++) { 12 | // inner loop to handle number of columns 13 | for (j = 1; j <= i; j++) { 14 | // printing column values upto the row 15 | // value. 16 | System.out.print(j + " "); 17 | } 18 | 19 | // print new line for each row 20 | System.out.println(); 21 | } 22 | } 23 | 24 | // Driver Function 25 | public static void main(String args[]) { 26 | int n = 6; 27 | printPattern(n); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tringle.java: -------------------------------------------------------------------------------- 1 | 2 | import java.util.*; 3 | 4 | public class tringle { 5 | // Function to demonstrate pattern 6 | public static void printPattern(int n) { 7 | int i, j; 8 | // outer loop to handle number of rows 9 | for (i = 1; i <= n; i++) { 10 | // inner loop to print space 11 | for (j = 1; j <= n - i; j++) { 12 | System.out.print(" "); 13 | } 14 | // inner loop to print star 15 | for (j = 1; j <= i; j++) { 16 | System.out.print(i + " "); 17 | } 18 | // print new line for each row 19 | System.out.println(); 20 | } 21 | } 22 | 23 | // Driver Function 24 | public static void main(String args[]) { 25 | int n = 6; 26 | printPattern(n); 27 | } 28 | } 29 | --------------------------------------------------------------------------------