Sei sulla pagina 1di 207

6/19/2019 20 Different Number Pattern Programs In Java

Java Concept Of The Day


Java Tutorial Site For Beginners

Home Arrays Strings Exception Handling Threads Generics Collections JDBC 


Interview Programs

Getting Started 20 Different


Classes & Objects Number Pattern
Inheritance
Programs In Java
Polymorphism
 pramodbablad  August 28,
Abstraction 2016 | 472

Packages

Type Casting
Number Pattern
Programs In Java :
Nested Classes
Java programs to print the numbers
Java Enums
or any other symbols in different
Wrapper Classes patterns are one of the frequently
asked interview programs mostly for
Arrays
freshers. Because, they test the
Strings candidate’s logical ability as well as
coding skills which are ‘must have
Exception Handling
skills’ for any software engineer. In
Threads this post, I have collected some of
the different number pattern
File I/O
programs in java and have tried to
Generics solve them. I hope they will be
helpful for you guys.
Java Collections

JDBC

Interview Programs

Interview Q&A

x Vs y

Java 8

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 1/207
6/19/2019 20 Different Number Pattern Programs In Java

Pattern 1 :
1
12
123
1234
12345
123456
1234567

Java Program :

1 import java.util.Scanne
2
3 public class MainClass
4 {
5 public static void
6 {
7 Scanner sc = ne
8
9 //Taking rows v
10
11 System.out.prin
12
13 int rows = sc.n
14
15 System.out.prin
16
17 for (int i = 1;
18 {
19 for (int j
20 {
21 System.
22 }
23
24 System.out.
25 }
26
27 //Close the res
28
29 sc.close();
30 }
31 }

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 2/207
6/19/2019 20 Different Number Pattern Programs In Java

Output :

How many rows you want in this


pattern?
7
Here is your pattern….!!!
1
12
123
1234
12345
123456
1234567

Pattern 2 :
1
22
333
4444
55555
666666
7777777

Java Program :

1 import java.util.Scanne
2
3 public class MainClass
4 {
5 public static void
6 {
7 Scanner sc = ne
8
9 //Taking rows v
10
11 System.out.prin
12
13 int rows = sc.n
14
15 System.out.prin
16
17 for (int i = 1;
18 {
19 for (int j
20 {
21 System.
22 }
23
24 System.out.
25 }
26
27 //Close the res
28
29 sc.close();
30 }
31 }

Output :

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 3/207
6/19/2019 20 Different Number Pattern Programs In Java

How many rows you want in this


pattern?
7
Here is your pattern….!!!
1
22
333
4444
55555
666666
7777777

Pattern 3 :
1
12
123
1234
12345
123456
1234567
123456
12345
1234
123
12
1

Java Program :

1 import java.util.Scanne
2
3 public class MainClass
4 {
5 public static void
6 {
7 Scanner sc = ne
8
9 //Taking rows v
10
11 System.out.prin
12
13 int rows = sc.n
14
15 System.out.prin
16
17 //Printing uppe
18
19 for (int i = 1;
20 {
21 for (int j
22 {
23 System.
24 }
25
26 System.out.
27 }
28
29 //Printing lowe

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 4/207
6/19/2019 20 Different Number Pattern Programs In Java
30
31 for (int i = ro
32 {
33 for (int j
34 {
35 System.
36 }
37
38 System.out.
39 }
40
41 //Closing the r
42
43 sc.close();
44 }
45 }

Output :

How many rows you want in this


pattern?
7
Here is your pattern….!!!
1
12
123
1234
12345
123456
1234567
123456
12345
1234
123
12
1

Pattern 4 :
1234567
123456
12345
1234
123
12
1

Java Program :

1 import java.util.Scanne
2
3 public class MainClass
4 {
5 public static void
6 {
7 Scanner sc = ne
8
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 5/207
6/19/2019 20 Different Number Pattern Programs In Java
9 //Taking rows v
10
11 System.out.prin
12
13 int rows = sc.n
14
15 System.out.prin
16
17 for (int i = ro
18 {
19 for (int j
20 {
21 System.
22 }
23
24 System.out.
25 }
26
27 //Closing the r
28
29 sc.close();
30 }
31 }

Output :

How many rows you want in this


pattern?
7
Here is your pattern….!!!
1234567
123456
12345
1234
123
12
1

[quads id=5]

Pattern 5 :
7654321
765432
76543
7654
765
76
7

Java Program :

1 import java.util.Scanne
2
3 public class MainClass
4 {
5 public static void
6 {
7 Scanner sc = ne
8
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 6/207
6/19/2019 20 Different Number Pattern Programs In Java
9 //Taking rows v
10
11 System.out.prin
12
13 int rows = sc.n
14
15 System.out.prin
16
17 for (int i = 1;
18 {
19 for (int j
20 {
21 System.
22 }
23
24 System.out.
25 }
26
27 //Closing the r
28
29 sc.close();
30 }
31 }

1. Easy Dress Patterns a

2. Java Certification Courses a

3. Java Online Training a

4. Java Programs For Practice a

5. Simple Apron Pattern a

Output :

How many rows you want in this


pattern?
7
Here is your pattern….!!!
7654321
765432
76543
7654
765
76
7

Pattern 6 :
7
76
765
7654
76543

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 7/207
6/19/2019 20 Different Number Pattern Programs In Java

765432
7654321

Java Program :

1 import java.util.Scanne
2
3 public class MainClass
4 {
5 public static void
6 {
7 Scanner sc = ne
8
9 //Taking rows v
10
11 System.out.prin
12
13 int rows = sc.n
14
15 System.out.prin
16
17 for (int i = ro
18 {
19 for (int j
20 {
21 System.
22 }
23
24 System.out.
25 }
26
27 //Closing the r
28
29 sc.close();
30 }
31 }

Output :

How many rows you want in this


pattern?
7
Here is your pattern….!!!
7
76
765
7654
76543
765432
7654321

Pattern 7 :
7654321
654321
54321
4321
321
21
1
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 8/207
6/19/2019 20 Different Number Pattern Programs In Java

Java Program :

1 import java.util.Scanne
2
3 public class MainClass
4 {
5 public static void
6 {
7 Scanner sc = ne
8
9 //Taking rows v
10
11 System.out.prin
12
13 int rows = sc.n
14
15 System.out.prin
16
17 for (int i = ro
18 {
19 for (int j
20 {
21 System.
22 }
23
24 System.out.
25 }
26
27 //Closing the r
28
29 sc.close();
30 }
31 }

Output :

How many rows you want in this


pattern?
7
Here is your pattern….!!!
7654321
654321
54321
4321
321
21
1

Pattern 8 :
1234567
123456
12345
1234
123
12
1
12
123

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 9/207
6/19/2019 20 Different Number Pattern Programs In Java

1234
12345
123456
1234567

Java Program :

1 import java.util.Scanne
2
3 public class MainClass
4 {
5 public static void
6 {
7 Scanner sc = ne
8
9 //Taking rows v
10
11 System.out.prin
12
13 int rows = sc.n
14
15 System.out.prin
16
17 //Printing uppe
18
19 for (int i = ro
20 {
21 for (int j
22 {
23 System.
24 }
25
26 System.out.
27 }
28
29 //Printing lowe
30
31 for (int i = 2;
32 {
33 for (int j
34 {
35 System.
36 }
37
38 System.out.
39 }
40
41 //Closing the r
42
43 sc.close();
44 }
45 }

Output :

How many rows you want in this


pattern?
7
Here is your pattern….!!!
1234567
123456
12345
1234
123

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 10/207
6/19/2019 20 Different Number Pattern Programs In Java

12
1
12
123
1234
12345
123456
1234567

Pattern 9 :
1
121
12321
1234321
123454321
12345654321
1234567654321

Java Program :

1 import java.util.Scanne
2
3 public class MainClass
4 {
5 public static void
6 {
7 Scanner sc = ne
8
9 //Taking rows v
10
11 System.out.prin
12
13 int rows = sc.n
14
15 System.out.prin
16
17 for (int i = 1;
18 {
19 //Printing
20
21 for (int j
22 {
23 System.
24 }
25
26 //Printing
27
28 for (int j
29 {
30 System.
31 }
32
33 System.out.
34 }
35
36 //Closing the r
37
38 sc.close();
39 }
40 }

Output :

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 11/207
6/19/2019 20 Different Number Pattern Programs In Java

How many rows you want in this


pattern?
7
Here is your pattern….!!!
1
121
12321
1234321
123454321
12345654321
1234567654321

Pattern 10 :
1
21
321
4321
54321
654321
7654321

Java Program :

1 import java.util.Scanne
2
3 public class MainClass
4 {
5 public static void
6 {
7 Scanner sc = ne
8
9 //Taking rows v
10
11 System.out.prin
12
13 int rows = sc.n
14
15 System.out.prin
16
17 for (int i = 1;
18 {
19 for (int j
20 {
21 System.
22 }
23
24 System.out.
25 }
26
27 //Close the res
28
29 sc.close();
30 }
31 }

Output :

How many rows you want in this


pattern?
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 12/207
6/19/2019 20 Different Number Pattern Programs In Java

7
Here is your pattern….!!!
1
21
321
4321
54321
654321
7654321

1 2

Categories Java Interview Programs

 How To How To 
Reverse An Format
ArrayList In Date In
Java? Java?

472 Comments

Faizaan
September 2, 2016 (9:52 pm) #

I had fun playing around with this!

Reply

rajesh
March 16, 2017 (1:50 pm) #

@@@@@@@
@@ @@
@@@@
@ @@ @
@@@
@@@@@@@
can u please write code for this

Reply

Abhishek
April 11, 2017 (5:54 pm) #

void pattern() {
for (int i = 1; i <= 6; i++) {

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 13/207
6/19/2019 20 Different Number Pattern Programs In Java

if (i == 1 || i == 6) {
for (int j = 1; j <= 7; j++) {

System.out.print("@");

}
}

if (i == 2 || i == 3 || i == 4) {
for (int j = 1; j <= 4; j++) {
System.out.print("@");
if (i == 2 && j == 2) {
System.out.print(" ");
}
if (i == 3) {
System.out.print(" ");
}
if ((i == 4) && (j == 1 || j ==
3)) {
System.out.print(" ");
}
}
}

if (i == 5) {
for (int j = 1; j <= 3; j++) {
System.out.print("@" + " ");
}
}

System.out.println();
}

OUTPUT:
@@@@@@@
@@ @@
@@@@
@ @@ @
@@@
@@@@@@@

Reply

Bishal Das
July 13, 2017 (9:30 am) #

plz write code for this


1
23

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 14/207
6/19/2019 20 Different Number Pattern Programs In Java

456
7 8 9 10

Reply

hola
July 21, 2017 (7:31 am) #

package paterns;
public class Paterns
{
public static void
main(String[] args)
{int no=1;
for (int i =0; i<=3; i++)
{

for (int j =0; j <=i; j++)


{
System.out.print(no);
no++;
}
System.out.println();
}
}
}

Jay Mehta
July 22, 2017 (4:38 pm) #

import java.io.*;
class Pattern1
{
public static void
main(String[] args)throws
IOException
{
int value = 1;
for(int i =1;i<=4;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(value+" ");
value++;
}
System.out.println();
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 15/207
6/19/2019 20 Different Number Pattern Programs In Java

}
}

Ankit Vishnoi
August 1, 2017 (9:22 pm) #

*#######
######**
***#####
####****
****####
#####***
**######
#######*

Janu
August 31, 2017 (11:23 pm)
#

import java.util.Scanner;

public class Asdsf {

public static void


main(String[] args) {
// TODO Auto-generated
method stub
System.out.println(“Enter the
no. of rows”);
Scanner sc = new
Scanner(System.in);
int n = sc.nextInt();
int num = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(num+" ");
num = num + j;
}
System.out.println();
}
}

Pyda Neelima
September 17, 2017 (5:42
pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 16/207
6/19/2019 20 Different Number Pattern Programs In Java

import java.util.*;
public class MyPattern {
public static void main(String
args[]) {
Scanner s=new
Scanner(System.in);
int n=s.nextInt();
int j=1,i,k;
for(i=1;i<=n;i++)
{
k=i;
while(k!=0)
{
System.out.print(j+" ");
j++;
k–;
}
System.out.println();
}
}
}

Ancu S Johnson
March 16, 2018 (10:03 am)
#

import java.util.*;
class Pattern{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter
limit”);
int limit=sc.nextInt();
int num=1;
System.out.println(“Pattern
is…………..!!!”);
for(int i=1;i<=limit;i++){
for(int j=1;j<=i;j++){
System.out.print(num+" ");
num++;
}
System.out.print("\n");
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 17/207
6/19/2019 20 Different Number Pattern Programs In Java

}
}

Tarique
March 16, 2018 (3:32 pm) #

public class Tariq


{
public static void main(String
args[])
{
int i, j, n=1;
for(i=0; i<4; i++)
{
for(j=0; j<=i; j++)
{
System.out.print(n+ " ");
n++;
}
System.out.println();
}
}
}

hiba
May 14, 2018 (2:11 pm) #

How to print?
*
***
***
*

Ancu S Johnson
June 9, 2018 (5:17 am) #

import java.util.*;
class Pattern{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter
limit”);
int limit=sc.nextInt();
System.out.println(“Pattern
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 18/207
6/19/2019 20 Different Number Pattern Programs In Java

is………..”);
int num=1;
for(int i=1;i<=limit;i++){
System.out.print("\n");
for(int j=i;j<=limit;j++){
System.out.print(num+" ");
num++;
}

}
}

Shweta Sarsar
August 19, 2018 (4:20 am)
#

public class Add


{
public static void main(String
[]args)
{
int k=1;
for(int i=1;i<=4;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(k);
k++;

}
System.out.println();
}
}

Janani
January 21, 2019 (5:13 am)
#

public class Pattern


{
void pattern()
{
int s=1;
for(int i=1;i<=3;i++)

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 19/207
6/19/2019 20 Different Number Pattern Programs In Java

{
for(int j=1;j<=i;j++)
{
System.out.print(s);
s=s+1;
}
System.out.println();
}

Fateh Mohammed
January 30, 2019 (6:41 am)
#

class Pattern {

public static void


main(String[] args)
{
int i, j, k = 1;
for (i = 1; i <= 4; i++)
{
for (j = 1; j < i + 1; j++)
{
System.out.print(k++ + " ");
}

System.out.println();
}
}

DEBRUPA SEN
May 1, 2019 (6:57 pm) #

// c coding
#include
#include
void main()
{
int i,j,k,m=1;
clrscr();
for(i=1;i<=4;i++)
{
/*for(k=2;k<=i;k=k+2)
{
printf(" ");
}*/

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 20/207
6/19/2019 20 Different Number Pattern Programs In Java

for(j=1;j<=i;j++)
{
printf("%d",m);
m=m+1;
}
printf("\n");
}
getch();
}

Ancu S Johnson
June 9, 2018 (5:13 am) #

class Pattern{
public static void main(String
args[]){
for(int i=1;i<=6;i++){

for(int j=1;j<=1;j++){
if((i==1)||(i==6)){
System.out.println("@@@@@
@@");
}
else if((i==2)||(i==3)||
(i==4)){
System.out.println("@@@@");
}
else{
System.out.println("@@@");
}
}
}
}
}

Reply

Na
January 8, 2019 (3:38 pm) #

How about this…


Input: 1
Output :0
Next
Input :2
Output:
0
010
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 21/207
6/19/2019 20 Different Number Pattern Programs In Java

0
1

Reply

avi
February 4, 2019 (12:20 pm)
#

can u print this


AAAAA
AAAA
AAA
AA
A

Reply

Manoj
February 10, 2019 (2:19 am)
#

for(int i=5;i>0;i–)
{
for(int j=1;j<=i;j++)
{ System.out.print("A");
}
System.out.println();
}

Ancu S Johnson
March 16, 2018 (9:56 am) #

class Pattern{
public static void main(String
args[]){
for(int i=1;i<=6;i++){

for(int j=1;j<=1;j++){
if((i==1)||(i==6)){
System.out.println("@@@@@
@@");
}
else if((i==2)||(i==3)||(i==4))
{
System.out.println("@@@@");
}
else{

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 22/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println("@@@");
}
}
}
}
}

Reply

hemant
April 26, 2017 (1:02 am) #

question reply please

func(int n) {
n>=0
}

if n=5 then output 012345


543210
if n=6 then output 0123456
6543210

solve quick

Reply

Abhishek Bhardwaj
June 5, 2017 (5:30 am) #

Did you mean This :


Output:
01234566543210
CODE:
public void func(int value) {
int j, i;

if (value >= 0) {
if (value == 5) {
for (i = 0; i = 0; j–) {
System.out.print(” ” + j + ” “);
}
}

}
}
if (value == 6) {
for (i = 0; i = 0; j–) {
System.out.print(” ” + j + ” “);
}
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 23/207
6/19/2019 20 Different Number Pattern Programs In Java

}
}

if (value == 6) {
}
} else {
System.out.println(“Value is less
then 0”);
}

Reply

Jay Mehta
July 22, 2017 (4:43 pm) #

import java.io.*;
class Pattern1
{
public static void main(String[]
args)throws IOException
{

for(int i =0;i=0;i–)
{
System.out.print(i+” “);
}
}
}

Reply

Raj
February 24, 2018 (11:28 am)
#

public class Simple


{
public static void main(String[]
args)
{ int i,n=6;
for(i=0;i=0;i–)
{
System.out.print(i);
}
}
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 24/207
6/19/2019 20 Different Number Pattern Programs In Java

Ebad Ali
August 27, 2017 (3:57 am) #

i want this java program


1******
12*****
123****
1234***
12345**
123456*
1234567 can u please give me its
code

Reply

Vishal Singh
August 29, 2017 (8:44 am) #

import java.util.Scanner;
class p
{
public static void main(String
arg[])
{
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter
number of rows “);
int n=sc.nextInt();
int j;
for(int i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
System.out.print(j);
for(int k=j;k<=n;k++)
System.out.print("*");
System.out.println();
}
}
}

Reply

Yogesh Choudhary
September 11, 2017 (9:22 am)
#

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 25/207
6/19/2019 20 Different Number Pattern Programs In Java

import java.util.Scanner;

public class pattern_2 {

public static void main(String[]


args) {

Scanner sc=new
Scanner(System.in);
int n=sc.nextInt();
for(int i=1;i<=n;i++)
{
for(int j=1;ji)
System.out.print(“*”);
else
System.out.print(j);
}
System.out.println();
}

Reply

akhi
September 12, 2017 (8:28 pm)
#

class Patterns
{
public static void main(String[]
args)
{

for (int i=1;i<=5 ;i++ )


{
for (int j=1;j=j)
System.out.print(j);
else
System.out.print(“*”);
}
System.out.println();
}

}
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 26/207
6/19/2019 20 Different Number Pattern Programs In Java

Pyda Neelima
September 17, 2017 (5:53 pm)
#

import java.util.*;
public class MyClass {
public static void main(String
args[]) {
Scanner s=new
Scanner(System.in);
int n=s.nextInt();
int j,i;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(j<=i)
System.out.print(j);
else
System.out.print("*");
}
System.out.println();
}
}
}
output:
1******
12*****
123****
1234***
12345**
123456*
1234567

Reply

Muhammed07
October 1, 2017 (1:46 am) #

can u pls write a code for tis


output:
1
25
368
4 7 9 10*

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 27/207
6/19/2019 20 Different Number Pattern Programs In Java

Rakesh katholla
January 10, 2019 (4:21 pm)
#

import java.util.*;
public class Test
{
public static void Pattern()
{
int i,j;
int k;
int n=4;
for(i=1; i<=n; i++)
{
k=i;
for(j=1; j<=i; j++)
{
System.out.print(k+" ");
k=k+n-j;
}
System.out.println();
}
}
public static void main(String
args[])
{
Scanner sc=new
Scanner(System.in);
int n=sc.nextInt();
Test t=new Test();
t.Pattern();
}
}

Ancu S Johnson
June 9, 2018 (5:28 am) #

import java.util.*;
class TestPattern{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter the
row limit”);
int limit=sc.nextInt();

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 28/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println(“Pattern…
………..!!”);
for(int i=1;i<=limit;i++){
for(int j=1;ji;j–){
System.out.print(“* “);
}
System.out.print(“\n”);
}
}
}

Reply

shashi
January 7, 2019 (6:07 pm) #

543212345
4321234
32123
212
1
Write the code in jawa this
pattern

Raj
February 24, 2018 (11:33 am)
#

public class Simple


{
public static void main(String[]
args)
{ int i,n=6,j=0;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(j<=i)
System.out.print(j);
else
System.out.print("*");
}
System.out.println();
}
}
}

Reply
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 29/207
6/19/2019 20 Different Number Pattern Programs In Java

Sushma Musuku
May 29, 2019 (12:54 am) #

$$$$
$$
$$
$$$$
Can you pls help me in writing
the code for above pattern???

Reply

Ancu S Johnson
March 16, 2018 (10:14 am) #

import java.util.*;
class Pattern{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter
limit”);
int limit=sc.nextInt();
System.out.println(“Pattern
is………..”);

for(int i=1;i<=limit;i++){
System.out.print("\n");
for(int j=1;j<=i;j++){
System.out.print(j+" ");
}
for(int j=i;j<=limit;j++){
System.out.print("* ");
}

}
}

Reply

Ivaan
June 12, 2019 (8:58 am) #

Can you write the code for


55555
4444

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 30/207
6/19/2019 20 Different Number Pattern Programs In Java

333
22
1

Reply

Vishali
October 22, 2017 (6:38 pm) #

can you please write code for

1234
5
6
987

Reply

Vishali
October 22, 2017 (6:41 pm) #

and this pattern also

1234
5
6
987

Reply

Vijay
November 4, 2017 (10:35 am)
#

public class Test


{
public static void main(String…
s){
int i,j, n=1;
for(i=1;i=1;j–){
if(n ==5 || n == 6) {
System.out.print(n);
n++;
break;
} else{
System.out.print(n);
n++;
}
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 31/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println();
}

for(j= (n + i-2);j>=n;j–){
System.out.print(j);
}
}

Reply

Raj
February 24, 2018 (11:45 am)
#

public class Simple


{
public static void main(String[]
args)
{ int i,n=6,j=0;
String k=””;
for(i=1;i<=9;i++)
{
if(i<=4)
System.out.print(i);
else if(i==5 )
System.out.print("\n"+i);
else if(i==6)
System.out.print("\n"+i+"\n");
else
k="" +i+k;
}
System.out.println(k);
}
}

Reply

Harshit
January 12, 2019 (4:32 am) #

Plzz do this
*
*#
*#*
*#*#
*#*#*

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 32/207
6/19/2019 20 Different Number Pattern Programs In Java

hiba
May 14, 2018 (2:09 pm) #

How to print:-
1
2
12321
4
5

Reply

vijoy
November 29, 2016 (5:39 pm) #

how to print this pattern in java


0
90
890
7890
67890

Reply

Lokesh Mahadev
December 27, 2016 (1:57 pm) #

import java.util.*;
class Patternn
{
public static void main(String[]
args)
{
Scanner scan=new
Scanner(System.in);
System.out.println(“Enter the
number of rows”);
int row=scan.nextInt();
int num=0;

for(int i=0;i<row;i++)
{
num=10-i;
for(int j=0;j<=i;j++)
{
if(i==j)
{
System.out.print("0"+" ");
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 33/207
6/19/2019 20 Different Number Pattern Programs In Java

}
else
{
System.out.print(num+" ");
num++;
}
}
System.out.println();
}
}
}

Reply

rony
December 21, 2018 (8:43 am)
#

what is the question of this


program,please tell.

Reply

Lokesh Mahadev
December 27, 2016 (2:01 pm) #

import java.util.*;
class Patternn
{
public static void main(String[]
args)
{
Scanner scan=new
Scanner(System.in);
System.out.println(“Enter the
number of rows”);
int row=scan.nextInt();
int num=0;

for(int i=0;i<row;i++)
{
num=10-i;
for(int j=0;j<=i;j++)
{
if(i==j)
{
System.out.print("0"+" ");
}
else
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 34/207
6/19/2019 20 Different Number Pattern Programs In Java

{
System.out.print(num+" ");
num++;
}
}
System.out.println();
}
}
}

output-
0
90
890
7890
67890

Reply

arpiy
August 17, 2017 (1:09 pm) #

2
34
456
5678

Reply

Somnath Bhattacharjee
August 31, 2017 (9:32 am) #

import java.util.*;
class Patternn
{
public static void main(String[]
args)
{
Scanner sc=new
Scanner(System.in);
System.out.print(“Enter the
number of lines :: “);
int l=sc.nextInt();
int i,j, c=0;
for(i=2;i<=(l+2);i++)
{
for(j=i;j<=(i+c);j++)
System.out.print( j+" ");
c++;
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 35/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println();
}

}
}

Reply

jvp
July 7, 2017 (6:44 pm) #

public class CustomerReq {

public static void main(String[]


args)
{
Scanner sc = new
Scanner(System.in);

//Taking rows value from the


user

// System.out.println(“How many
rows you want in this pattern?”);

int rows = 5;

System.out.println(“Here is your
pattern….!!!”);

//Printing lower half of the


pattern
int res=10;
for (int i =1; i<=rows; i++)
{

for (int j = 1; j<= i; j++)


{
if(res==10)
{
System.out.println(" 0");
}
else
{
System.out.print(" "+res);
}
res++;
}
res=10-i;
System.out.println();
}
//Closing the resources

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 36/207
6/19/2019 20 Different Number Pattern Programs In Java

sc.close();
}
}

Reply

Raj
February 24, 2018 (12:22 pm) #

public class Simple


{
public static void main(String[]
args)
{ int i=0,j=0,k=0,n=8;
for(i=10;i>=6;i–)
{
for(j=i;j<=10;j++)
{
if (j==10)
System.out.print("0");
else
System.out.print(j);
}
System.out.println();
}
}
}

Reply

Anonymous010
April 22, 2018 (8:20 am) #

import java.io.*;
class patt2
{ public static void main(String
args[])
{ int n=10,i,j;
for(j=n;j>=1;j–)
{ for(i=j;i<=n;i++)
{ System.out.print(i%10+" ");
}
System.out.println();
}
}
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 37/207
6/19/2019 20 Different Number Pattern Programs In Java

Ancu S Johnson
June 9, 2018 (5:45 am) #

import java.util.*;
class TestPattern{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter the row
limit”);
int limit=sc.nextInt();
System.out.println(“Pattern………
…..!!”);
for(int i=limit+1;i>=1;i–){
for(int j=i;j<=limit+1;j++){
if(j==limit+1){
System.out.print("0");
}
else
System.out.print(j+" ");
}

System.out.print("\n");
}
}
}

Reply

VK
December 4, 2016 (10:59 am) #

help me in forming this pattern


AAAA
AAA
AA
A

Reply

Nagendra
December 9, 2016 (5:54 am) #

int n = 4;
for(int i=1;ii;j–)
{
System.out.print(“A”);
}
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 38/207
6/19/2019 20 Different Number Pattern Programs In Java

for(int k=1;k<=i;k++)
{
System.out.print(" ");
}
System.out.println();
}

Reply

sharath reddy
December 15, 2016 (5:53 pm) #

its just the for part


for(i=rows;i>1;i–)
{
for(j=1;j<=i;j++)
{
S.O.P('A');
}
S.O.Pln();
}

Reply

Jay Mehta
July 22, 2017 (4:50 pm) #

import java.io.*;
class Pattern1
{
public static void main(String[]
args)throws IOException
{
for(int i = 1;i=i;j–)
{
System.out.print(“A “);
}
System.out.println();
}
}
}

Reply

Ancu S Johnson
June 9, 2018 (5:48 am) #

import java.util.*;
class TestPattern{
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 39/207
6/19/2019 20 Different Number Pattern Programs In Java

public static void main(String


args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter the row
limit”);
int limit=sc.nextInt();
System.out.println(“Pattern………
…..!!”);

for(int i=limit;i>=1;i–){
for(int j=1;j<=i;j++){

System.out.print("A ");
}

System.out.print("\n");
}
}
}

Reply

VK
December 4, 2016 (11:00 am) #

give the code for this pattern


AAAA
AAA
AA
A

Reply

rvi
December 14, 2016 (9:33 am) #

for (int i=4;i>=1; i–){


for (int j=1; j<=i;j++){
System.out.print("A ");
}
System.out.println();

Reply

Raju verma
August 5, 2017 (12:14 pm) #

psvm(str at[])
{ for(int i=1;i<=1;I++)
{ for (int j=1;j<=i;j++)
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 40/207
6/19/2019 20 Different Number Pattern Programs In Java

{
Sop(i+" ");}
Sopln(" A");
}
}

Reply

Varsha
December 5, 2016 (1:39 pm) #

How to print below pattern?


123
456
789

Reply

kavin
January 2, 2017 (4:31 pm) #

public class Mainclass {


public static void
main(String[]args){
int i,j;

for(j=1;j<=9;j++)
{
if(j%3==0){
System.out.println(j);
}
else
System.out.print(j);
}

}
}

Reply

MD BELAL HODA
August 18, 2017 (5:17 pm) #

package basics;

public class Demo {


public static void main(String[]
args) {
int n = 3;
int count = 1;
for (int i = 0; i < n; i++) {
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 41/207
6/19/2019 20 Different Number Pattern Programs In Java

for (int j = 0; j < n; j++) {


System.out.print(" " + count++);
}
System.out.println();
}
}
}

Reply

Vishal Singh
August 29, 2017 (8:47 am) #

import java.util.Scanner;
class p
{
public static void main(String
arg[])
{
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter
number of rows “);
int n=sc.nextInt();
int t=1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
System.out.print(t);
t++;
}
System.out.println();
}
}
}

Reply

Ancu S Johnson
June 9, 2018 (5:52 am) #

import java.util.*;
class TestPattern{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 42/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println(“Pattern………
…..!!”);
int num=1;
for(int i=1;i<=3;i++){
for(int j=1;j<=3;j++){

System.out.print(num+" ");
num++;
}

System.out.print("\n");
}
}
}

Reply

ammy
December 9, 2016 (3:13 pm) #

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

Reply

Niranjan Kumar
January 14, 2017 (5:38 pm) #

class A
{
public static void main(String[]
args)
{
for(int i = 1; i<=6;i++)
{
for(int j = 1; j<=i; j++)
{
System.out.print('*');
}
System.out.println();
}
}
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 43/207
6/19/2019 20 Different Number Pattern Programs In Java

nitesh kumar
July 15, 2017 (1:44 pm) #

class Demo
{
public static void main(String[]
args)
{
int i,j,n=5;
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(j);
}
System.out.println();
}}}

Reply

Ancu S Johnson
June 9, 2018 (5:55 am) #

import java.util.*;
class TestPattern{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter the
limit”);
int limit=sc.nextInt();
System.out.println(“Pattern………
…..!!”);

for(int i=1;i<=limit;i++){
for(int j=1;j<=i;j++){

System.out.print("* ");

System.out.print("\n");
}
}
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 44/207
6/19/2019 20 Different Number Pattern Programs In Java

av
December 12, 2016 (12:13 pm) #

how to print below pattern?


1
92
10 8 3
14 11 7 4
15 13 12 6 5

Reply

Meghna
February 12, 2017 (8:55 am) #

How to print this pattern?


12345
6789
10 11 12
13 14
15

Reply

V vikram
March 4, 2017 (1:54 pm) #

class PatternDemo{
public static void pattern(int f){
int a=f;
int b=1;
for(int i=0;i<=f;i++){
for(int j=0;j<=a;j++){
System.out.print(b+" ");
b++;
}a–;
System.out.println();
}
}
public static void main(String
[]args){
pattern(4);
}
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 45/207
6/19/2019 20 Different Number Pattern Programs In Java

vikram v
March 4, 2017 (1:59 pm) #

public class PatternDemo {


public static void pattern(int f){
int a=f;
int b=1;
for(int i=0;i<=f;i++){
for(int j=0;j<=a;j++){
System.out.print(b+" ");
b++;
}a–;
System.out.println();
}
}

public static void main(String[]


args) {
pattern(4);
}

Reply

susmitha
May 5, 2017 (2:45 pm) #

public static void main(String[]


args)throws Exception {
// TODO code application logic
here
Scanner in=new
Scanner(System.in);
int n=in.nextInt();
int k=n;
int l=1;
int p=n-1;
for(int i=0;i<n;i++)
{
for(int j=l;j<=k;j++)
{

System.out.print(j+" ");

}
l=k+1;
k=k+p;
p–;
System.out.print("\n");
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 46/207
6/19/2019 20 Different Number Pattern Programs In Java

}
}

Reply

Rakesh kumar kushwaha


June 20, 2017 (4:11 am) #

class Temp
{
public static void main(String []
args)
{
int n=1;
int columns = 5;
for(int i=1;i<=5;i++)
{
for(int j=1;j<=columns;j++)
{
System.out.print(n+"\t");
n++;
}
columns–;
System.out.println();
}
}
}

Reply

Somnath Bhattacharjee
August 31, 2017 (10:00 am) #

import java.util.*;
class Patternn
{
public static void main(String[]
args)
{
Scanner sc=new
Scanner(System.in);
System.out.print(“Enter the
number of lines :: “);
int l=sc.nextInt();
int i,j, c=1;
for(i=l;i>=1;i–)
{
for(j=1;j<=i;j++)

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 47/207
6/19/2019 20 Different Number Pattern Programs In Java

{
System.out.print(c+" ");
c++;
}
System.out.println();
}
}
}

Reply

Ancu S Johnson
March 16, 2018 (11:02 am) #

import java.util.*;
class Pattern10{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter
limit”);
int limit=sc.nextInt();
System.out.println(“Pattern
is………..”);
int num=1;
for(int i=1;i<=limit;i++){
System.out.print("\n");
for(int j=i;j<=limit;j++){
System.out.print(num+" ");
num++;
}

}
}

Reply

Ancu S Johnson
June 9, 2018 (6:34 am) #

import java.util.*;
class TestPattern{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 48/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println(“Enter the
row limit”);
int limit=sc.nextInt();
System.out.println(“Pattern……
……..!!”);
int n=1;
for(int i=1;i=i;j–){

System.out.print(n+” “);
n++;
}

System.out.print(“\n”);
}
}
}

Reply

Ankit
June 5, 2018 (5:48 am) #

public class Pattern {

public static void main(String[]


args) {

int n=5,k=1;
int arr[][]=new int[n][n];

int c=0,d=n,f,g=0;
while(k<=15)
{
g=c;
f=n-1;
if(c%2==0)
{

d–;
for(int i=0;i=0;i–)
{
arr[f][i]=k;

k++;
f–;
}

c++;
}
}
for(int i=0;i<n;i++)
{

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 49/207
6/19/2019 20 Different Number Pattern Programs In Java

for(int j=0;j<n;j++)
{
if(arr[i][j]!=0)
System.out.print(arr[i][j]+" ");
}
System.out.println();
}
}

Reply

shivam
December 24, 2016 (2:40 am) #

how to print this pattern in java


plz send me source code.
1
23
456
7 8 9 10

Reply

yogesh swami
January 4, 2017 (2:10 am) #

Plz give me cod

Reply

surendra reddy
February 14, 2017 (2:24 pm) #

for(i=1;i<=4;i++)
{
int num =1;
for(j=1;j<=i;j++)
{
system.out.println (num+ " ");
num++;
}
}

Reply

siva
March 17, 2017 (5:26 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 50/207
6/19/2019 20 Different Number Pattern Programs In Java

plz tell me
0
456
654

Reply

Jay Mehta
July 22, 2017 (5:40 pm) #

import java.io.*;
class Pattern1
{
public static void main(String[]
args)throws IOException
{
int i,j;
int num =1;
for(i=1;i<=4;i++)
{

for(j=1;j<=i;j++)
{
System.out.print (num+ " ");
num++;
}
System.out.println();
}
}}

Reply

Jay Mehta
July 22, 2017 (5:41 pm) #

OUTPUT:
1
23
456
7 8 9 10

Reply

Ancu S Johnson
June 9, 2018 (6:37 am) #

import java.util.*;
class TestPattern{
public static void main(String

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 51/207
6/19/2019 20 Different Number Pattern Programs In Java

args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter the row
limit”);
int limit=sc.nextInt();
System.out.println(“Pattern………
…..!!”);
int n=1;
for(int i=1;i<=limit;i++){
for(int j=1;j<=i;j++){

System.out.print(n+" ");
n++;
}

System.out.print("\n");
}
}
}

Reply

musharraf
January 16, 2019 (4:57 am) #

class Second
{
public static void main(String
[]args)
{
int k = 1;
for (int i = 1; i <= 4; i++)
{ for (int j = 1; j <= i; j++)
{
System.out.print(k++ );
}
System.out.println();
}
}
}

Reply

hit
December 29, 2016 (10:10 am) #

3
23

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 52/207
6/19/2019 20 Different Number Pattern Programs In Java

123
0123
how this..

Reply

Coder007
January 31, 2017 (2:08 pm) #

for(int i=3;i>=0;i–)
{
for(int j=i;j<=3;j++)
{

System.out.print(j);
}
System.out.println();
}

Reply

Ancu S Johnson
June 9, 2018 (6:41 am) #

import java.util.*;
class TestPattern{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter the
limit”);
int limit=sc.nextInt();
System.out.println(“Pattern………
…..!!”);
for(int i=limit;i>=0;i–){
for(int j=i;j<=limit;j++){

System.out.print(j+" ");
}

System.out.print("\n");
}
}
}

Reply

VAMSI
December 31, 2016 (12:51 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 53/207
6/19/2019 20 Different Number Pattern Programs In Java

how to print this pattern in java


plz send me source code.
*
??
***
????

Reply

Coder007
January 31, 2017 (2:13 pm) #

for(i=1;i<=4;i++){
for(j=1;j<=i;j++){
if(i%2==0){
System.out.print("?");
}
else{
System.out.print("*");
}
}System.out.println();
}

Reply

Rakesh kumar kushwaha


June 20, 2017 (4:15 am) #

class Temp
{
public static void main(String []
args)
{
for(int i=1;i<=4;i++)
{
for(int j=1;j<=i;j++)
{
if(i%2==0)
{
System.out.print("?");
}
else
{
System.out.print("*");
}
}
System.out.println();

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 54/207
6/19/2019 20 Different Number Pattern Programs In Java

}
}
}

Reply

Ancu S Johnson
June 9, 2018 (6:43 am) #

import java.util.*;
class TestPattern{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter the
limit”);
int limit=sc.nextInt();
System.out.println(“Pattern………
…..!!”);
for(int i=1;i<=limit;i++){
for(int j=1;j<=i;j++){
if(i%2==0)
System.out.print("? ");
else
System.out.print("* ");
}

System.out.print("\n");
}
}
}

Reply

Himanshu
January 1, 2017 (1:11 pm) #

*
**
***@
** @
*@*
@ **
@***
**
*

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 55/207
6/19/2019 20 Different Number Pattern Programs In Java

Jay Mehta
July 22, 2017 (6:08 pm) #

public static void main(String[]


args)throws IOException
{
for(int i=1;i<=2;i++)
{
for(int j = 1;j<=i;j++)
{
System.out.print("*");
}
System.out.println();
}
for(int i = 1;i=i;j–)
{
System.out.print(“*”);
}
if(i != 3)
{
System.out.print(“@”);
System.out.println();
}
else
{
System.out.print(“@*”);
System.out.println();
}

}
for(int i =2;i<=3;i++)
{
System.out.print("@");

for(int j = 1;j<=i;j++)
{
System.out.print("*");
}
System.out.println();
}
for(int i =1;i=i;j–)
{
System.out.print(“*”);

}
System.out.println();
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 56/207
6/19/2019 20 Different Number Pattern Programs In Java

OUTPUT:
*
**
***@
**@
*@*
@ **
@***
**
*

Reply

Mae
January 8, 2019 (3:42 pm) #

Pleasee help me to this.


Input: 1
Output: 0
Next another input
Input : 2
Output:
0
010
0
1

Reply

Himgauri Khaladkar
January 3, 2017 (12:54 pm) #

How to print below pattern?


MMSDD
MSSSD
CSSSK
CCSKK

Reply

Jay Mehta
July 22, 2017 (6:24 pm) #

public static void main(String[]


args)throws IOException
{
int i,j;
for(i=1;i=i;j–)
{
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 57/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.print(“M”);
}
int k =1;
if(k==i)
System.out.print(“S”);
else
System.out.print(“SSS”);

for(j=2;j>=i;j–)
{
System.out.print(“D”);
}
System.out.println();
}
for(i=1;i<=2;i++)
{
for(j=1;j<=i;j++)
{
System.out.print("C");
}
int k=1;
if(k!=i)
System.out.print("S");
else
System.out.print("SSS");
for(j=1;j<=i;j++)
{
System.out.print("K");
}
System.out.println();
}
OUTPUT:
MMSDD
MSSSD
CSSSK
CCSKK

Reply

Ambuj jha
January 3, 2017 (2:16 pm) #

how to print following pattern in


java
ABCDEFEDCBA
ABCDEEDCBA
ABCDDCBA
ABCCBA

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 58/207
6/19/2019 20 Different Number Pattern Programs In Java

ABBA
AA

Reply

Coder007
January 31, 2017 (3:52 pm) #

int Alpha;
for(i=6;i>=1;i–){
Alpha=65;
for(j=1;j=65){
for(int k=1;k<=i;k++){

–Alpha;
System.out.print((char) Alpha);
}
}System.out.println();
}}}

Reply

Jay Mehta
July 22, 2017 (7:17 pm) #

public static void main(String[]


args)throws IOException
{

for(int i=1;i<=6;i++)
{

for(int j=65;j=65;j–)
{
System.out.print((char)j);
}

System.out.println();
}
}
OUTPUT:
ABCDEFFEDCBA
ABCDEEDCBA
ABCDDCBA
ABCCBA
ABBA
AA

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 59/207
6/19/2019 20 Different Number Pattern Programs In Java

Ancu S Johnson
June 9, 2018 (10:57 am) #

import java.util.*;
class TestPattern{
public static void main(String
args[]){
Scanner sc=new
Scanner(System.in);
System.out.println(“Enter the
limit”);
int limit=sc.nextInt();
System.out.println(“pattern………
……………….!!”);
for(int i=limit;i>=0;i–){
int ch=65;
for(int j=1;j<=i;j++){

System.out.print((char)ch);
ch++;
}
int c=ch-1;
for(int j=1;j<=i;j++){

System.out.print((char)c);
c–;
}
System.out.print("\n");
}
}
}

Reply

ashish ranjan
January 4, 2017 (11:31 am) #

How to print this pattern


a
aba
abcba
aba
a

Reply

ashish
January 4, 2017 (11:31 am) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 60/207
6/19/2019 20 Different Number Pattern Programs In Java

How to print this pattern


a
aba
abcba
aba
a

Reply

Jay Mehta
July 22, 2017 (7:54 pm) #

for(int i =1;i<=4;i++)
{
for(int j = 97;j97;j–)
{
int k = j-1;
System.out.print((char)k);
}
System.out.println();

}
for(int i=4-1;i>=1;i–)
{
for(int j = 97;j=97;j–)
{
System.out.print((char)j);
}
System.out.println();
}
OUTPUT:
a
aba
abcba
abcdcba
abcba
aba
a

Reply

Ancu S Johnson
June 9, 2018 (11:11 am) #

import java.util.*;
class TestPattern{
public static void main(String
args[]){
Scanner sc=new
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 61/207
6/19/2019 20 Different Number Pattern Programs In Java

Scanner(System.in);
System.out.println(“Enter the
limit”);
int limit=sc.nextInt();
System.out.println(“pattern………
……………….!!”);
for(int i=1;i<=limit;i++){
int ch=97;
for(int j=1;j<=i;j++){

System.out.print((char)ch);
ch++;
}
int c=ch-2;
for(int j=2;j<=i;j++){

System.out.print((char)c);
c–;
}
System.out.print("\n");
}
for(int i=1;i<=limit;i++){
int ch=97;
for(int j=i;j<=limit;j++){

System.out.print((char)ch);
ch++;
}
int c=ch-2;
for(int j=i+1;j<=limit-1;j++){

System.out.print((char)c);
c–;
}
System.out.print("\n");
}
}
}

Reply

raghu v c
January 4, 2017 (2:24 pm) #

how to write
1
23
456
78910
1112131415

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 62/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

Gudise Sree Harsha


January 9, 2017 (11:27 am) #

import java.util.Scanner;
class Pattern
{
public static void main(String
[]args)
{
Scanner s = new
Scanner(System.in);
int d = s.nextInt();
int count=1;
for(int i=1;i<=d;i++)
{
for(int j=0;j<i;j++)
{
System.out.print(count+" ");
}
System.out.println();
}
}
}

Reply

Muhammad Anees
March 3, 2017 (1:09 pm) #

/*
* To change this template,
choose Tools | Templates
* and open the template in the
editor.
*/
package Patterns;

/**
*
* @author Muhammad Anees
*/
public class Pattern14 {

public static void main(String[]


args) {

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 63/207
6/19/2019 20 Different Number Pattern Programs In Java

int n = 5;
int num = 1;
System.out.println(“Here is your
pattern….!!!”);

for (int i = 1; i <= n; i++) {

for (int j = 1; j <= i; j++) {


System.out.print(num+" ");
num++;

System.out.println();
}

}
}

Reply

naveen
January 4, 2017 (5:48 pm) #

how to print:

1
23
456
78910

Reply

Likith
February 9, 2017 (2:53 pm) #

Which class are u

Reply

Eswar
January 9, 2018 (5:14 pm) #

class NewPattern3
{
public static void main(String[]
args)
{ int k=1;
for (int i=1;i<=4 ;i++ )
{
//int k=1;
for (int j=1;j<=i ;j++ )
{
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 64/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.print(k);
k++;
}
System.out.println();
}
//System.out.println();
}
}

Reply

Narendra
January 5, 2017 (12:32 pm) #

how to print :-

1
12
234
4867
7 8 9 10 11

Reply

jay mehta
July 26, 2017 (10:23 am) #

public static void main(String[]


args)throws IOException
{
BufferedReader br = new
BufferedReader(new
InputStreamReader(System.in));
int n =
Integer.parseInt(br.readLine());
System.out.println(“1”);
int value=1;
for(int i = 2;i<=n;i++)
{
for(int j = 1;j<=i;j++)
{
System.out.print(value+" ");
value++;
}
value=value-1;
System.out.println();
}
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 65/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

Raj
February 24, 2018 (1:01 pm) #

public class Simple


{
public static void main(String[]
args)
{ int i=0,j=0,k=0,n=8;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(++k);
}
–k;
System.out.println();
}
}
}

Reply

ravi
January 6, 2017 (4:30 pm) #

logic to this pattern


input:4….
1
3*2
4*5*6
10*9*8*7

Reply

jay mehta
July 23, 2017 (6:41 am) #

int last=0;
for(int i=1;i0;l–)
{

System.out.print(j–);
if(l>1)
System.out.print(“*”);

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 66/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println();
}

Reply

Vikas P S
August 2, 2017 (9:05 am) #

Int number=1;

for(int i=1;i<=4;i++)
{
if(i%2==1)
{
For(int j=1;j<=i;j++)
{
System.out.print(number++);
}
}
Else
{
number=number+i-1;
For(int j=1;j<=i;j++)
{
System.out.print(number–);
}
number=number+i-1;
}
}

Reply

Jarvis
January 7, 2017 (12:56 pm) #

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

Reply

Book lover
January 11, 2017 (3:23 pm) #

Please help me with this program

1
23

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 67/207
6/19/2019 20 Different Number Pattern Programs In Java

456
78910

Reply

Raj
February 24, 2018 (1:02 pm) #

public class Simple


{
public static void main(String[]
args)
{ int i=0,j=0,k=0,n=8;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(++k);
}
–k;
System.out.println();
}
}
}

Reply

kakarla venkata anvesh


April 9, 2018 (10:00 am) #

public static void main(String


[]args){
int x=1;
for(int i=1;i<=6;i++){

for(int j=1;j<=i;j++){
System.out.print(x);
x=x+1;
}
System.out.println();
}
}

Reply

Gadha
January 13, 2017 (5:05 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 68/207
6/19/2019 20 Different Number Pattern Programs In Java

How to solve this pattern


5AAAA
44BBB
333CC
2222D
11111

Reply

jay mehta
July 26, 2017 (12:12 pm) #

public static void main(String[]


args)throws IOException
{
BufferedReader br = new
BufferedReader(new
InputStreamReader(System.in));
int n =
Integer.parseInt(br.readLine());
int k=0;
for(int i =n;i>=1;i–)
{
for(int j = n; j >=i; j–)
{
System.out.print(i);
}
for(int j = 1; j < i;j++)
{
k = 65;
System.out.print((char)k);
}k++;
System.out.println();
}
}

Reply

Ancu S Johnson
June 9, 2018 (5:04 am) #

class NumberAlphabets{
public static void main(String
args[]){

int alp=65;
for(int i=5;i>=1;i–){

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 69/207
6/19/2019 20 Different Number Pattern Programs In Java

for(int j=5;j>=1;j–){
if(i<=j){
System.out.print(i+" ");
}
else{
System.out.print((char)alp+" ");
}

}
alp++;
System.out.print("\n");
}

}
}

Reply

Dilip
January 18, 2017 (1:53 pm) #

a program for following pattern


j
ja
jav
java

Reply

Coder007
February 1, 2017 (5:07 am) #

String str=”java”;
for(int i=0;i<4;i++){
for(int j=0;j<=i;j++){
char ch[]=str.toCharArray();
System.out.print(ch[j]);
}
System.out.println();
}

Reply

Sambit
January 20, 2017 (4:31 pm) #

121212
212121
323232
414141

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 70/207
6/19/2019 20 Different Number Pattern Programs In Java

525252
616161

Reply

rahul devda
January 20, 2017 (5:15 pm) #

A program for following pattern


1
11
121
1331
14641

Reply

Coder007
February 1, 2017 (5:14 am) #

int num=1;
System.out.println(1);
for(int i=1;i<=4;i++){
num=num*11;
System.out.print(num);
System.out.println();
}

Reply

justin
February 21, 2017 (3:41 pm) #

thanks a lot….. such an easy


prg 4 15 marks won’t cum
though….

Reply

Jasmeet Singh
January 23, 2017 (3:33 pm) #

How to print this..

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

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 71/207
6/19/2019 20 Different Number Pattern Programs In Java

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

Reply

Coder007
February 1, 2017 (6:23 am) #

int num=0;
for(int i=0;i0;j–){

System.out.print(“*”);

}num=num+2;

System.out.println();
}
num=1;
for(int i=3;i>=1;i–){
for(int k=1;k<=num+2;k++){
System.out.print("*");

}
num=num+2;
System.out.println();
}

Reply

Karthik Madhavn
April 28, 2017 (5:47 pm) #

for(int i=0;i<5;i++){
for(int j=i;j<6-1;j++){

System.out.print("*");
}
System.out.println();
}

for(int i=1;i<5;i++){
for(int j=0;j<i+1;j++){
System.out.print("*");
}
System.out.println();
}

Reply

Arjun Rathod
January 23, 2017 (6:17 pm) #

Program for Below Pattern


https://javaconceptoftheday.com/number-pattern-programs-in-java/ 72/207
6/19/2019 20 Different Number Pattern Programs In Java

1*2*3*4
9*10*11*12
17*18*19*20
13*14*15*16
5*6*7*8

Reply

aditi
July 20, 2018 (2:08 pm) #

/**************************
***************************
*************************

Online C++ Compiler.


Code, Compile, Run and Debug
C++ program online.
Write your code in this editor and
press “Run” button to compile
and execute it.

***************************
***************************
*************************/

#include

using namespace std;

int main()
{
int n = 4;
int mat[n][n];
int a=1;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
mat[i][j]=a;
a++;
}
}

for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<mat[i][j];
if(j < n-1)
cout<<" * ";

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 73/207
6/19/2019 20 Different Number Pattern Programs In Java

}
cout<=0;i–)
{
for(int j=0;j<n;j++)
{
cout<<mat[i][j];
if(j < n-1)
cout<<" * ";
}
cout<<endl;
i–;
}
return 0;
}

Reply

Jayanth
January 24, 2017 (2:40 pm) #

How to print

+++++
—–
+++++

Reply

jay mehta
July 23, 2017 (6:54 am) #

public static void main(String[]


args)throws IOException
{
BufferedReader br = new
BufferedReader(new
InputStreamReader(System.in));
int n =
Integer.parseInt(br.readLine());
for(int i=1;i<=n;i++)
{
if(i==1 || i==n)
{
for(int j=1;j<=5;j++)
{
System.out.print("+");
}
}
else
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 74/207
6/19/2019 20 Different Number Pattern Programs In Java

{
for(int j = 1;j<=n;j++)
{
System.out.print("-");
}
}
System.out.println();
}

}
OUTPUT:
6
+++++
——
——
——
——
+++++

Reply

Akhilesh
January 27, 2017 (3:29 pm) #

Kindly help me I want to print


below pattern
1
AB
234
CDFG
I did but I want some other logic ,
I looking for reply —-

public class ForLoop {

public static void main(String[]


args) {

for (int i=1; i<=1; i++){


System.out.print(i+" ");
}
System.out.println();
for (int i=65; i<67; i++){
char ch = (char) i;
System.out.print(ch+" ");
}
System.out.println();
for(int i=2;i<=4;i++){
System.out.print(i+" ");
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 75/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println();
for (int i=67; i<=70; i++){
char ch = (char) i;
System.out.print(ch+" ");
}
}
}

Reply

Abhishek H R
March 2, 2017 (7:54 am) #

public class Launch1108 {

public static void main(String[]


args) {
int count=0;
char ch = ‘A’;
for(int i=1;i<=4;i++)
{
for(int j=1;j<=i;j++)
{
if((i%2)!=0)
{
count++;
System.out.print(count+" ");
}

else
{
if(ch=='E')
{
ch++;
}
System.out.print(ch+" ");
ch++;
}
}
System.out.println( );
}

Reply

Raj
February 24, 2018 (1:53 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 76/207
6/19/2019 20 Different Number Pattern Programs In Java

public class Simple


{
public static void main(String[]
args)
{ int i=0,j=0,k=1,n=1;

for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
if(i%2==1)
System.out.print(k++ + " ");
else
System.out.print( (char) (n++ +
64));
}

System.out.println();
}
}
}

Reply

amit
February 2, 2017 (5:21 pm) #

How this print?


543210
43210
3210
210
10
0

Or

012345
01234
0123
012
01
0

Reply

Abhishek H R
March 2, 2017 (8:40 am) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 77/207
6/19/2019 20 Different Number Pattern Programs In Java

public class c109


{
public static void main(String[]
args)
{
int i,j;
int count;
for(i=1;i=i;j–)
{

System.out.print(count+” “);
count++;
}
System.out.println();
}

Reply

Abhishek H R
March 2, 2017 (8:41 am) #

public class c109


{
public static void main(String[]
args)
{
int i,j;
int count;
for(i=1;i=i;j–)
{

System.out.print(count+” “);
count++;
}
System.out.println();
}

Reply

Amritha
February 3, 2017 (3:55 pm) #

15 14 13 12 11
10987

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 78/207
6/19/2019 20 Different Number Pattern Programs In Java

654
32
1

Reply

retr0
February 3, 2017 (5:15 pm) #

How to print this pattern-


123454321
1234 4321
123 321
12 21
11

Reply

retr0
February 3, 2017 (5:20 pm) #

How to print this pattern-


123454321
1234*4321
123***321
12*****21
1*******1

Reply

jay mehta
July 23, 2017 (8:48 am) #

int val = 5,val1=5;


for(int i = 1;i<=5;i++)
{

for(int j = 1;j <= val;j++)


{
System.out.print(j);

}val–;
if(i != 1)
{
for(int k=1; k=1;j–)
{
System.out.print(j);
}
val1–;
System.out.println();

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 79/207
6/19/2019 20 Different Number Pattern Programs In Java

}
OUTPUT:
123454321
1234*4321
123***321
12*****21
1*******1

Reply

Neeru
May 31, 2019 (7:24 am) #

12
43
56
87
9 10
Code these

Reply

Sonika
February 4, 2017 (10:54 am) #

How to get this pattern??

0
01
024
0369
0 4 8 12 16
0 5 10 15 20 25

Reply

jay mehta
July 26, 2017 (12:51 pm) #

public static void main(String[]


args)throws IOException
{
BufferedReader br = new
BufferedReader(new
InputStreamReader(System.in));
int n =
Integer.parseInt(br.readLine());
System.out.println(“0”);
for(int i = 1;i<=n;i++)

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 80/207
6/19/2019 20 Different Number Pattern Programs In Java

{
for(int j = 0; j <= i; j++)
{
if(j==0)
{
System.out.print("0 ");
}
else
{
System.out.print(i*j+" ");
}
}
System.out.println();
}

}
OUTPUT:
5
0
01
024
0369
0 4 8 12 16
0 5 10 15 20 25

Reply

Anil
February 4, 2017 (3:37 pm) #

How to print this :-


*
***
*****
*******
*********
@*
@ **
@ ***
@ ****
@@@@@*****
****
***
**
*

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 81/207
6/19/2019 20 Different Number Pattern Programs In Java

jay mehta
July 26, 2017 (6:28 pm) #

public static void main(String[]


args)throws IOException
{
BufferedReader br = new
BufferedReader(new
InputStreamReader(System.in));
int n =
Integer.parseInt(br.readLine());
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= (2*i)-1; j++)
{
System.out.print("*");
}
System.out.println();
}
for(int i = 1; i <= n-1; i++)
{
for(int j = 1; j <= i; j++)
{
if(j==1)
System.out.print("@");
System.out.print("*");
}
System.out.println();
}
for(int i = 1; i <= n; i++)
{
System.out.print("@");
}
for(int i = 1; i <= n; i++)
{
System.out.print("*");
}
System.out.println();
for(int i = 1;i = i; j–)
{
System.out.print(“*”);
}
System.out.println();
}
OUTPUT:
5

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 82/207
6/19/2019 20 Different Number Pattern Programs In Java

*
***
*****
*******
*********
@*
@**
@***
@****
@@@@@*****
****
***
**
*

Reply

Raj
February 5, 2017 (10:55 am) #

How to print
0
01
024
0369
0 4 8 12 16
0 5 10 15 20 25

Reply

sanketa
February 8, 2017 (5:29 am) #

For this?

123432114321234
123321121432234
1221123214334
11123432144
1221123214334
123321121432234
123432114321234

Reply

MAISURIYA VIRAL
February 8, 2017 (2:16 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 83/207
6/19/2019 20 Different Number Pattern Programs In Java

Where this patturn:


1
22
333
4444
55555

Reply

MAISURIYA VIRAL
February 8, 2017 (2:18 pm) #

Where this patturn:


.1
.22
.333
.4444
.55555

Reply

Deekshu
January 17, 2018 (6:04 am) #

public static void main(String[]


args)
{

int i,j,n;
System.out.println(“Enter the
number of rows:”);
Scanner sc= new
Scanner(System.in);
n=sc.nextInt();
for(i=0;i<=n;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(i+"\t");
}
System.out.println();
}

Reply

Abhishek
February 10, 2017 (1:23 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 84/207
6/19/2019 20 Different Number Pattern Programs In Java

*
*#
*#*
*#*#
*#*#*

For this

Reply

SK FIROJ
May 25, 2017 (6:50 pm) #

public class pattern


{
public static void main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
if(j%2==0)
System.out.print("#");
else
System.out.print("*");
}
System.out.println();
}
}
}

Reply

Nithya
September 27, 2017 (10:17
am) #

1*
2* 3*
4* 5# 6*
7* 8* 9* 10*
Plz help me

Reply

Rakesh kumar kushwaha


June 20, 2017 (6:48 am) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 85/207
6/19/2019 20 Different Number Pattern Programs In Java

class Temp
{
public static void main(String []
args)
{

for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
if(j%2==0)
{
System.out.print("#");
}
else
{
System.out.print("*");
}
}
System.out.println();
}
}
}

Reply

Amcat
February 11, 2017 (8:26 am) #

//Program this without taking


input from console (If Enters N=3
then print like below)

333
313
323
333

//(If enters N = 4 then)

4444
4144
4244
4344
4444

Reply

Thejeshwar MP
February 17, 2017 (6:59 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 86/207
6/19/2019 20 Different Number Pattern Programs In Java

Scanner sc = new
Scanner(System.in);
System.out.println(“Enter the
number”);
int n = sc.nextInt();
for (int i = 1; i <=n+1; i++) {
int num = i;
for (int j = 1; j <= n; j++) {
if(i == 1 || j != 2){
System.out.print(n);

}else{
System.out.print(num-1);
}
}
System.out.println();
}

sc.close();

Reply

simant kumar
July 9, 2018 (1:14 pm) #

import java.util.*;
class Pattern1
{

public static void main(String


args[])
{
Scanner sc=new
Scanner(System.in);
System.out.print(“enter the value
“);
int n=sc.nextInt();

if(n%2==0)
{
int a=(n+1)/2;
for(int i=0;i<=n;i++)
{
System.out.print(n);
System.out.print(" ");
}
System.out.println();
for(int i=1;i<=n;i++)
{

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 87/207
6/19/2019 20 Different Number Pattern Programs In Java

for(int j=0;j<=n-1;j++)
{
if(j==a)
{
System.out.print(i);
System.out.print(" ");

}
System.out.print(n);
System.out.print(" ");

}
System.out.println();
}
}

else
{
int b=(n)/2;
for(int i=1;i<=n;i++)
{
System.out.print(n);
System.out.print(" ");
}
System.out.println();
for(int i=1;i<=n;i++)
{
for(int j=0;j<=n-2;j++)
{
if(j==b)
{
System.out.print(i);
System.out.print(" ");

}
System.out.print(n);
System.out.print(" ");

}
System.out.println();
}
}

sc.close();
}
}

OUTPUT will be, when you enter


4
44444
44144

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 88/207
6/19/2019 20 Different Number Pattern Programs In Java

44244
44344
44444
this is the correct answer for
input 4, which is asked in wipro
amcat
And for input 3 answer will be
333
313
323
333

Reply

Tirthankar Ghosh
February 13, 2017 (2:56 pm) #

How can I print this pattern ?

123
412
312

Reply

AJAY
February 18, 2017 (11:45 am) #

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

Reply

Abhishek H R
March 2, 2017 (7:04 am) #

for(int i=1;i<=7;i++)
{
if(i==1 ||i==7)
{
System.out.println("*");
}
else
{

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 89/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println("**");
}
}

Reply

Madhuri
February 20, 2017 (11:38 am) #

Please give code for this

if n=3, print this


1*2*3
7*8*9
4*5*6

if n=4, print this


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

Reply

Rishika
February 22, 2017 (9:55 pm) #

Please help me in working out this


pattern
13579
35791
57913
79135
91357

Reply

Ashwani Jaiswal
December 18, 2017 (12:00 am)
#

#include
int main()
{
int i,j,k=1;
for(i=1;i<=5;i++)
{
for(j=i;j<=5;j++)
{
k=2*j-1;

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 90/207
6/19/2019 20 Different Number Pattern Programs In Java

printf("%d",k);
}
for(j=1;j<i;j++)
{
k=2*j-1;
printf("%d",k);
}
printf("\n");

}
}

Reply

Fajar Agustin
February 23, 2017 (10:46 am) #

can u help me with pattern like


this :

12345
234
3
234
12345

thank a lot

Reply

Jason
February 27, 2017 (6:49 am) #

can u help me working out this


pattern?
00000
00123
01357
0 2 5 8 11

Reply

Rica
March 1, 2017 (4:05 pm) #

Plz send me the coding for:


1
32
654
10 9 8 7

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 91/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

prachi
March 3, 2017 (4:12 am) #

how to print this patter:


1234567
123567
1267
17
1267
123567
1234567

Reply

praveen kumar verma


April 3, 2018 (12:19 pm) #

public class Patten {


public static void main(String[]
args) {

int count =0;

for(int i=1;i<=5 ;i++)


{
count = count+i;
for(int j=1 ;j<=i;j++)
{
System.out.print(count);
count–;
}
count = count+i;
System.out.println();

}
}
}

Reply

Rica
March 3, 2017 (2:19 pm) #

Please help me with this pattern:


1
32
654
10 9 8 7

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 92/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

Rakesh kumar kushwaha


June 20, 2017 (4:58 am) #

class Temp
{
public static void main(String []
args)
{
int n=0;
for(int i=1;i<=4;i++)
{
n = n+i;
int k=n;
for(int j=1;j<=i;j++)
{
System.out.print(k+"");
k–;
}
System.out.println();
}
}
}

Reply

Surya
March 4, 2017 (2:03 pm) #

how to print this pattern


54321
4321
321
21
1
can you please help me.

Reply

urvashi johri
April 5, 2017 (8:56 am) #

import java.util.Scanner;

public class Pattern2 {


public static void main(String[]
args) {
int i,j;
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 93/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println(“Enter rows”);
Scanner sc=new
Scanner(System.in);
int rows=sc.nextInt();
for ( i = rows; i>=1; i–)
{
for ( j = i; j >= i; j–)

{
System.out.print(j);
}
System.out.println();
}
sc.close();
}
}

Reply

abhishek
April 13, 2017 (3:54 pm) #

class Pattern
{
public static void main(String
args[])
{
int a,i;
for(i=1;i=1;a–)
{
System.out.print(a);
}
}
}
}

Reply

Simran Gupta
March 6, 2017 (12:54 pm) #

How to print this pattern??


5
44
333
2222
11111

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 94/207
6/19/2019 20 Different Number Pattern Programs In Java

Shailesh
April 7, 2017 (5:59 pm) #

class Test
{
public static void main(String[]
args)
{
for (int i = 5; i >= 1 ;i– )
{
for (int j = 5; j >= i;j– )
{
System.out.print(i);
}
System.out.println();
}
}
}

Reply

Trisha Banerjee
March 7, 2017 (3:53 pm) #

This is really good


I really enjoyed executing these
programs

Reply

PRATEEK SINGH
June 13, 2017 (4:48 pm) #

WHAT IS WRONG IN IT????????


class ad
{
public void main()
{
for(int f=5;f>=1;f–)
{
System.out.println();

for(int h=1;h<=5-f;h++);
System.out.print(" ");
for(int u=1;u<=f;u++);
System.out.print("#");
}}}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 95/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

Anurag
March 17, 2017 (9:38 am) #

Kindly help me with this:

1234554321
1234 4321
123 321
12 21
11
12 21
123 321
1234 4321
1234554321

Reply

jay mehta
July 26, 2017 (7:27 pm) #

public static void main(String[]


args)throws IOException
{
BufferedReader br = new
BufferedReader(new
InputStreamReader(System.in));
int n =
Integer.parseInt(br.readLine());
int val = n;
for(int i = 1; i <= n; i++)
{
for(int j = 1;j = 1;j–)
{
System.out.print(j);
}
val–;
System.out.println();
}
for(int i = 2; i <= n; i++)
{
for(int j = 1; j=1;j–)
{
System.out.print(j);
}
System.out.println();
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 96/207
6/19/2019 20 Different Number Pattern Programs In Java

}
OUTPUT:
5
1234554321
12344321
123321
1221
11
1221
123321
12344321
1234554321

Reply

Robin Zacharias
March 19, 2017 (7:17 am) #

2B
3LL
8UUU
15EEEE
24 J J J J J

How can I print this

Reply

oglotl
March 21, 2017 (2:20 pm) #

I need this pattern. help me


please

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

Reply

Shailesh
April 7, 2017 (6:04 pm) #

class Test
{
public static void main(String[]
args)
{
for (int i = 1; i <= 5 ;i++ )

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 97/207
6/19/2019 20 Different Number Pattern Programs In Java

{
for (int j = 1; j <= 5;j++ )
{
System.out.print("*");
}
System.out.println();
}
}
}

Reply

Ashwani Jaiswal
December 16, 2017 (2:57 pm) #

/*
* To change this license header,
choose License Headers in
Project Properties.
* To change this template file,
choose Tools | Templates
* and open the template in the
editor.
*/

/**
*
* @author Ashwani Kumar
*/
public class unit9 {

/**
* @param args the command
line arguments
*/
public static void main(String[]
args) {
// TODO code application logic
here

int i,j,k=0,c;
for(i=1;i<=4;i++)
{
for(j=1;j<=5;j++)
{

System.out.print("*");
}
System.out.println();
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 98/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

Himel
March 28, 2017 (8:00 am) #

1234
567
89
10

please solve it

Reply

Shailesh
April 7, 2017 (6:02 pm) #

class Test
{
public static void main(String[]
args)
{
int temp = 1;
for (int i = 4; i >= 1 ;i– )
{
for (int j = 1; j <= i;j++ )
{
System.out.print(temp++ + " ");
}
System.out.println();
}
}
}

Reply

Ashwani Jaiswal
December 18, 2017 (12:07 am)
#

#include
int main()
{
int i,j,k=1;
for(i=1;i<=5;i++)
{

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 99/207
6/19/2019 20 Different Number Pattern Programs In Java

for(j=1;j<=5-i;j++)
{
printf("%d",k);
k++;
}
printf("\n");
}
}

Reply

Alok
April 6, 2017 (10:50 am) #

How to print –
a
aa
aaa
aaaa
aaaaa

Reply

Shailesh
April 7, 2017 (5:53 pm) #

class Test
{
public static void main(String[]
args)
{
for (int i = 1; i <= 5 ;i++ )
{
for (int j = 1; j <= i ;j++ )
{
System.out.print("a");
}
System.out.println();
}
}
}

Reply

Alok
April 6, 2017 (10:51 am) #

Please help me to solve it.

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 100/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

Shailesh
April 7, 2017 (5:52 pm) #

1234
5678
9123
4567

Reply

jay mehta
July 26, 2017 (7:35 pm) #

public static void main(String[]


args)throws IOException
{
BufferedReader br = new
BufferedReader(new
InputStreamReader(System.in));
int n =
Integer.parseInt(br.readLine());
int temp = 1;
for(int i = 1; i <= n; i++)
{
for(int j = 1; j 9)
temp = 1;
System.out.print(temp);
temp++;

}
System.out.println();
}
}
OUTPUT:
5
12345
67891
23456
78912
34567

Reply

PVSS
July 15, 2018 (5:17 am) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 101/207
6/19/2019 20 Different Number Pattern Programs In Java

import java.util.*;
public class Pattern6 {
public static void main(String[]
args) {
// TODO Auto-generated
method stub
int i,j,k,l;
Scanner sc = new
Scanner(System.in);
int n = sc.nextInt();;
int num=1;
for(i=1;i<=n;i++){
for(j=1;j9){
num=1;
}
}System.out.println();
}
}
}

Reply

Risov
April 12, 2017 (6:29 am) #

Help me to print this pattern


*
*****
***
*

Reply

Jose
April 19, 2017 (1:57 am) #

how to print a word out of


hashtags using 2dArrays?

Reply

khushi
April 20, 2017 (5:00 am) #

plz solve thisprint pattern if user


gives (3,2) as an input then the
output should be.
7 9 11
35
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 102/207
6/19/2019 20 Different Number Pattern Programs In Java

1
1
35

Reply

Ritwik
April 22, 2017 (7:16 pm) #

Plz tell me howto print


0
012
0248
0 3 6 9 12
0 4 8 12 16
0 5 10 15 20 25
0 6 12 18 24 30 36
0 7 14 21 28 35 42 49
0 8 16 24 32 40 48 56 64
0 9 18 27 36 45 54 63 72 81

Reply

Dhiraj Kumar
April 27, 2017 (10:30 am) #

class Pattern
{
public static void main (String[]
args)
{
int n=9;
for(int i=0;i<=n;i++)
{
System.out.print(0);
for(int j=1;j<=i;j++)
{
System.out.print(i*j);
}
System.out.println();
}
}
}

Output:
0
01
024
0369
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 103/207
6/19/2019 20 Different Number Pattern Programs In Java

0 4 8 12 16
0 5 10 15 20 25
0 6 12 18 24 30 36
0 7 14 21 28 35 42 49
0 8 16 24 32 40 48 56 64
0 9 18 27 36 45 54 63 72 81

Reply

MADHURI
April 25, 2017 (10:56 am) #

12345
1234
123
12
1
12345
2345
345
45
5
Code of above pattern

Code of above pattern

54321
4321
321
21
1
54321
5432
543
54
5
Code of above pattern

Code of above pattern

1
12
123
1234
12345
5
45
345
2345

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 104/207
6/19/2019 20 Different Number Pattern Programs In Java

12345
Code of above pattern

Code of above pattern

1
21
321
4321
54321
5
54
543
5432
54321
Code of above pattern

Code of above pattern

1
22
333
4444
55555
5
44
333
2222
11111
Code of above pattern

Code of above pattern

55555
4444
333
22
1
11111
2222
333
44
5
Code of above pattern

Code of above pattern

12345
4321
123
21
1
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 105/207
6/19/2019 20 Different Number Pattern Programs In Java

1234567
12345
123
1
Code of above pattern

Code of above pattern

1
01
101
0101
13579
3579
579
79
9
Code of above pattern

Code of above pattern

1
24
135
2468
13579
55555
45555
34555
23455
12345
Code of above pattern

Code of above pattern

1
23
456
78910
1
10
101
1010
10101
Code of above pattern

Code of above pattern

1
26
3 7 10
4 8 11 13
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 106/207
6/19/2019 20 Different Number Pattern Programs In Java

5 9 12 14 15
1
123
12345
1234567
Code of above pattern

Code of above pattern

12344321
123**321
12****21
1******1
1
234
56789
Code of above pattern

Code of above pattern

1 2 3 4 5 6 7 8 9 10
36 37 38 39 40 41 42 43 44 11
35 64 65 66 67 68 69 70 45 12
34 63 84 85 86 87 88 71 46 13
33 62 83 96 97 98 89 72 47 14
32 61 82 95 100 99 90 73 48 15
31 60 81 94 93 92 91 74 49 16
30 59 80 79 78 77 76 75 50 17
29 58 57 56 55 54 53 52 51 18
28 27 26 25 24 23 22 21 20 19
Code of above pattern

11111
2222
333
22
1
5432*
543*1
54*21
5*321
*4321
Code of above pattern

Code of above pattern

1
121
12321
1234321
0

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 107/207
6/19/2019 20 Different Number Pattern Programs In Java

909
89098
7890987
678909876
56789098765
4567890987654
345678909876543
23456789098765432
1234567890987654321
Code of above pattern

Code of above pattern

11
12 21
123 321
1234 4321
1234554321
1
21
321
4321
54321
Code of above pattern

Code of above pattern

1
232
45654
78910987
1
2*2
3*3*3
4*4*4*4
4*4*4*4
3*3*3
2*2
1
Code of above pattern

Code of above pattern

11
12 13
13 14 15
14 15 16 17
1
23
456

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 108/207
6/19/2019 20 Different Number Pattern Programs In Java

7 8 9 10
11 12 13 14 15
Code of above pattern

Code of above pattern

5
54
543
5432
54321
1
212
32123
4321234
Code of above pattern

Code of above pattern

1
23
345
4567
56789
12345
6789
10 11 12
13 14
15
Code of above pattern

Code of above pattern

1234
2341
3421
4321
11111
0000
111
00
1
Code of above pattern

Code of above pattern

1
4 9 16
25 36 49 64 81
100 121 144 169 196 225 256
289 324 361 400 441 484 529 576
625
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 109/207
6/19/2019 20 Different Number Pattern Programs In Java

11111
11
11
11
11111
Code of above pattern

Code of above pattern

1
12
123
1234
12345
1
123
12345
1234567
123456789
1234567
12345
123
1
Code of above pattern

Code of above pattern

*000*000*
0*00*00*0
00*0*0*00
000***000
555555555
544444445
543333345
543222345
543212345
543222345
543333345
544444445
555555555
Code of above pattern

Code of above pattern

1
11
121
1331
14641
1

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 110/207
6/19/2019 20 Different Number Pattern Programs In Java

24
369
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 56 64
9 18 27 36 45 54 63 72 81
10 20 30 40 50 60 70 80 90 100
Code of above pattern

Code of above pattern

1
12
358
13 21 34 55
89 144 233 377 610
11111
10001
10001
10001
11111
Code of above pattern

Code of above pattern

12345
21234
32123
43212
54321
1
32
456
10 9 8 7
11 12 13 14 15
Code of above pattern

Code of above pattern

1
232
34543
4567654
567898765
11
22
33
4

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 111/207
6/19/2019 20 Different Number Pattern Programs In Java

33
22
11
Code of above pattern

Code of above pattern

1
26
3 7 10
4 8 11 13
5 9 12 14 15
1
121
12321
1234321
123454321
Code of above pattern

Code of above pattern

1
22
33
44
33
22
1
12345
16 6
15 7
14 8
13 12 11 10 9
Code of above pattern

Code of above pattern

N=39714

39174
9174
174
74
4
Code of above pattern

Please solve this all Program in


java

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 112/207
6/19/2019 20 Different Number Pattern Programs In Java

uttara gadpale
April 25, 2017 (5:15 pm) #

how to print this pattern


3
7 21
15 45 90
31 93 155 217

Reply

nagaminash
May 1, 2017 (1:08 pm) #

**
**
*
**
**

How to print this??

Reply

minnie
May 1, 2017 (1:15 pm) #

*—*
-*-*-
–*–
-*-*-
*—*

Reply

minnie
May 1, 2017 (1:16 pm) #

*—*
-*-*-
–*–
-*-*-
*—*

please say me how to do this


pattern?

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 113/207
6/19/2019 20 Different Number Pattern Programs In Java

gyana
June 18, 2017 (1:48 pm) #

class pattern
{
public satic void main(Strings[]
args)
{
for(int i=1;i<=5;i++)
{
for(int j=1;j<5;j++)
{
if(i==j||(i+j)==6)
System.out.print("*");
else
System.out.print(" ");
}
System.out.println();
}
}
}

Reply

S .Pranav Balaji
May 2, 2017 (9:34 am) #

Help me print this pattern


123454321
1234*4321
123***321
12*****21
1*******1

Reply

Prakhar Singh
July 1, 2017 (5:44 am) #

public class Main-class


{
public static void main(String
args[])
{
for(int i=1;i<=5;i++)
{
int t=1;
for(int j=5;j<=i;j–)

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 114/207
6/19/2019 20 Different Number Pattern Programs In Java

{
System.out.print(t);
t++;
}
for(int sp=1;sp<i;sp++)
System.out.print("*");
System.out.println();
}
int x=4;
for(int a=1;a=1;s–)
System.out.print(s);
}
else
{
int y=x;
for(int h=1;h=a;b++)
{
System.out.print(y);
y–;
}
System.out.println();
x–;
}
}
}
}

Reply

Manoj
May 13, 2017 (3:28 pm) #

how to print like


1
26
3 7 10
4 8 11 13
5 9 12 14 15

Reply

Beant sra
May 25, 2017 (6:29 am) #

2
24
246
2468

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 115/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

Rakesh kumar kushwaha


June 20, 2017 (6:45 am) #

class Temp
{
public static void main(String []
args)
{

for(int i=1;i<=4;i++)
{
int n=0;
for(int j=1;j<=i;j++)
{
n = n+2;
System.out.print(n+"");
}
System.out.println();
}
}
}

Reply

Skiandra Zues Fonssui


August 12, 2017 (9:15 am) #

help me

ABCDE
_ABCD
__ABC
___AB
____A

Reply

ratan
January 27, 2018 (5:33 pm) #

import java.util.*;
class pattern
{ public static void main(String
args[])
{ Scanner sc = new
Scanner(System.in);
System.out.print(“enter n”);

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 116/207
6/19/2019 20 Different Number Pattern Programs In Java

int n = sc.nextInt();
{ for(int i=0;i<n;i++)
{
for(int j=0;j<=i;j++)
{
System.out.print((((2*n-1-
j)*j)/2)+(i+1));
}
System.out.println("");
}
}
}
}

Reply

Dishant Kumar Kushwaha


January 6, 2019 (5:11 pm) #

#include

int main()
{
int m = 5;
for (int i = 1; i <=m; i++)
{
int x = i;
for (int j = 1; j <= i; j++)
{
printf("%d ",x);
x+=m-j;
}

printf("\n");
}
return 0;
}

Reply

Sidharth Bhatia
May 22, 2017 (11:28 am) #

Please help how to print this


pattern:

*
***
ABCDEF

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 117/207
6/19/2019 20 Different Number Pattern Programs In Java

***
*

Reply

Vignesh
May 23, 2017 (11:50 am) #

How to make this pattern

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

It’s look like a letter Z…. then how


we make A to Z

Reply

GhouseRizvi
November 27, 2017 (7:46 pm) #

public class Border {

static void border(int n) {


for(int i=0;i<n;i++) {
for(int j=0;j<n;j++) {
if(i==0||j==0||i==n-1) {
System.out.print('*');
}else {
System.out.print(' ');
}
}
System.out.println();
}

}
public static void main(String[]
args) {
int num=5;
border(num);
}

Reply

SK FIROJ
May 25, 2017 (6:51 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 118/207
6/19/2019 20 Different Number Pattern Programs In Java

public class pattern


{
public static void main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
if(j%2==0)
System.out.print("#");
else
System.out.print("*");
}
System.out.println();
}
}
}

Reply

Mounika
May 26, 2017 (6:26 pm) #

for(int i=1;i=1;j–)
{
System.out.print(a+” “);

a=a+1;
}

System.out.println();
}

output: if n=5

1
23
345
4567
56789

Reply

Mounika
May 26, 2017 (6:29 pm) #

for(int i=1;i=1;j–)
{
System.out.print(a+” “);

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 119/207
6/19/2019 20 Different Number Pattern Programs In Java

a=a+1;
}
System.out.println();
}
output: if n=5
1
23
345
4567
56789

Reply

Raghavendra M
May 29, 2017 (6:27 am) #

PLz if any one knows tell me how


to print this Rectangle pattern

333
313
323
333

Reply

sangeetha
June 3, 2017 (9:22 am) #

send me the code for printing the


pattern in 5*5 matrix
12345
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25

Reply

Riya
June 6, 2017 (2:49 am) #

how to solve this pattern:


13579
35791
57913
79135
91357

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 120/207
6/19/2019 20 Different Number Pattern Programs In Java

brijesg
June 6, 2017 (7:06 am) #

How to print
*
*
*
*
*

Reply

Nilesh
June 12, 2017 (11:11 am) #

for(int i = 0 ; i < n ; i++){


System.out.println("*");
}

Reply

Vishnu Lal
June 6, 2017 (7:10 pm) #

1*
2*3*
4*5#6*

pls tell me how to do this


pattern??

Reply

Rakesh kumar kushwaha


June 20, 2017 (7:26 am) #

class Temp
{
public static void main(String []
args)
{
int n = 1;
for(int i=1;i<=3;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(n+"*");
n++;

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 121/207
6/19/2019 20 Different Number Pattern Programs In Java

}
System.out.println();
}
}
}

Reply

Himanshu
June 22, 2017 (7:07 am) #

class A
{
public static void main(String s[])
{
int a,b,c=1,d,e=0;
for(a=1;a<=3;a++)
{
for(b=1;b<=a;b++)
{
if(e==4)
{
System.out.print(c++ +"#");
e++;

continue;
}else
{
System.out.print(c++ + "*");
e++;
}}
System.out.println();
}
}
}

Reply

Akshay
February 28, 2018 (10:48 am) #

public class Demo {


public static void main(String[]
args){
int c=0;
for(int i=1;i<5;i++){

for(int j=1;j<i;j++){
c++;

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 122/207
6/19/2019 20 Different Number Pattern Programs In Java

if(c==5){
System.out.print(c + "#");
}else{
System.out.print(c + "*");
}
}
System.out.println();
}
}
}

output
1*
2*3*
4*5#6*

Reply

teja
June 7, 2017 (6:56 pm) #

a
bc
def
ghij
code for this

Reply

Himanshu
June 22, 2017 (6:39 am) #

class A
{
public static void main(String s[])
{
char a,b,c=97;
for(a=97;a<=100;a++)
{
for(b=97;b<=a;b++)
{
System.out.print(c++);
}
System.out.println();
}
}
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 123/207
6/19/2019 20 Different Number Pattern Programs In Java

Prakhar Singh
July 1, 2017 (5:09 am) #

public class Main-class


{
public static void main(String
args[])
{
int i, j,ch=97;
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)
System.out.print((char)ch);//type
casting
System.out.println(" ");
}
}
}

Reply

Mayaram Chaudhary
June 8, 2017 (8:48 am) #

MM MM
MMM MMM
MMMMMMMMM
MM M MM
MM MM
MM MM
If possible??

Reply

sandip jawanjal
June 12, 2017 (4:33 pm) #

7531357
75357
757
7

Reply

LALIT GAMBHIR
July 2, 2017 (7:40 am) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 124/207
6/19/2019 20 Different Number Pattern Programs In Java

Hi Can anyone please write the


code for

output-
when n=1
*@*

when n=3
**
**@@**
**

when n=5

**
***@@@@@***
**

Reply

Gauri Parihar
July 3, 2017 (8:05 am) #

please tell me the program for this


pattern:-
for n=1
(*)
n=2
((*))
(*)
n=3
(((*)))
((*))
(*)
and so on……

Reply

Pravin
July 3, 2017 (11:13 am) #

How to Print..

––––1
– – – 12
– – 123
– 1234
1234

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 125/207
6/19/2019 20 Different Number Pattern Programs In Java

Suprit samal
July 8, 2017 (1:52 pm) #

111111111
122222221
123333321
123444321
123454321
123444321
123333321
122222221
111111111

Reply

Mohamed
July 9, 2017 (8:31 pm) #

Hello,

I was happy to find this wonderful


website.
I am wondering if there is a
section on control statements and
logical operators, IF, ELSE, DO,
WHILE, etc.?
If not, where would you
recommend I go?

Best Regards,
Mohamed

Reply

Lakshmi
July 12, 2017 (12:27 am) #

Scanner scan = new


Scanner(System.in);
System.out.println(“Enter input
value:”);
int num = scan.nextInt();
for(int i =1; i=i;k–){
System.out.print(“-“);
}

for(int j =1;j<=i;j++){
System.out.print(j);
}
System.out.println();
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 126/207
6/19/2019 20 Different Number Pattern Programs In Java

}
for(int j =1;j<=num;j++){
System.out.print(j+" ");
}

Reply

balraj
July 13, 2017 (10:43 am) #

anyone can help to find these


pattern:
A
BC
CDE
FGHI
JKLMNO
PQRST
UVWX
YZ

Reply

ys
July 16, 2017 (5:01 am) #

12*4
5*78
* 10 11 *

any one can help to find this


pattern

Reply

Nish
July 16, 2017 (6:34 am) #

abcdcba
abc cba
ab ba
aa

how to print it

Reply

anurag
July 17, 2017 (4:24 am) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 127/207
6/19/2019 20 Different Number Pattern Programs In Java

write a program on different types


of numbers for my
project.example fibonacci series.

Reply

Scarlett
July 18, 2017 (11:24 pm) #

I think pattern 14 can be simplified


to:

int n; //rows
for (int I = 1; I <= n; I++)
{
for (int j = 1; j <= n; j++)
{
if (I % != 0)
num = (j % 2 == 0) ? 0 : 1;
else
num = (j % 2 == 0) ? 1: 0;
System.out.print(num);
}
System.out.println();

Reply

Skiandra Zues Fonssui


August 12, 2017 (9:13 am) #

plz solve
123454321
1234_4321
123___321
12______21
1________1

Reply

Chirantan Acharyya
July 22, 2017 (1:10 pm) #

help me

123454321
12344321
123321
1221
11

Reply
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 128/207
6/19/2019 20 Different Number Pattern Programs In Java

palash katare
July 29, 2017 (12:22 pm) #

class Pattern
{
public static void main(String
args[])
{
for(int i=5; i>=1; i–)
{
for(int j=1; j=1; j–)
{
System.out.print(j);
}
System.out.println();
}
}
}

Reply

vicky kumar
August 2, 2017 (1:05 pm) #

how to print this pattern using i


and j
04
13
31
40

Reply

rohan
August 3, 2017 (2:27 pm) #

how to print
55555
4444
333
22
1

Reply

kyrie irving
August 23, 2017 (11:06 am) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 129/207
6/19/2019 20 Different Number Pattern Programs In Java

hello rohan,
here is your java code
import java.util.Scanner;
public class Pattern4
{
public static void main(String[]
args)
{
Scanner sc = new
Scanner(System.in);
System.out.println(“How many
rows you want in this pattern?”);
int rows = sc.nextInt();
System.out.println(“Here is your
pattern….!!!”);
for (int i = 1; i = i; j–)
{
System.out.print(j+” “);
}

System.out.println();
}
sc.close();
}
}

Reply

Gokul Kathirvel
December 5, 2017 (6:00 am) #

hello rohan!!
class pattern {
public static void main(String[]
args) {

for(int i=5;i>=0;i–){

for(int j=1;j<=i;j++){

System.out.print(i);

}
System.out.println();
}
}
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 130/207
6/19/2019 20 Different Number Pattern Programs In Java

Rashmi
August 5, 2017 (4:49 pm) #

Hello, Please provide me the code


for the following pattern in Java.
*****
**
**
**
**
*****

Reply

Sunil Kumar
August 7, 2017 (10:58 am) #

3
7 21
15 45 75
31 93 155 217

How to solve dis Patten??

Reply

Debanjana
August 10, 2017 (7:14 am) #

How to display this??


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

Reply

Skiandra Zues Fonssui


August 12, 2017 (9:11 am) #

help out plzzzzzzzz

123454321
1234 4321
123 321
12 21
11

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 131/207
6/19/2019 20 Different Number Pattern Programs In Java

Skiandra Zues Fonssui


August 12, 2017 (9:11 am) #

help out plzzzzzzzz

123454321
1234 4321
123 321
12 21
11

Reply

Skiandra Zues Fonssui


August 12, 2017 (9:16 am) #

help me

ABCDE
_ABCD
__ABC
___AB
____A

Reply

austin
August 30, 2017 (7:35 am) #

import java.util.*;
class Fl1
{
public static void main(String
ar[])
{
Scanner sc=new
Scanner(System.in);
System.out.println(“enter the
string”);
String s=sc.next();
char ch[]=s.toCharArray();
int n=ch.length;
int i,j;
for(i=0;i0;sp–)
{
System.out.print(“_”);
}
for(j=0;j<(n-i);j++)
{

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 132/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.print(ch[j]);
}
System.out.println();
}
}
}

Reply

Sadiq
August 14, 2017 (4:56 pm) #

1
12
123
1234

Reply

arun baghel
August 16, 2017 (11:33 am) #

9
79
579
3579
13579
or
97531
7531
531
31
1
or
13579
3579
579
79
9
or
54321
5432
543
54
5

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 133/207
6/19/2019 20 Different Number Pattern Programs In Java

Chamzz
August 20, 2017 (3:04 pm) #

1234
2343
3412
4121

This pattern?

Reply

Kamlesh dabde
August 23, 2017 (8:53 am) #

can you minimize for this code

public static void main(String[] ar)


{
Scanner in = new
Scanner(System.in);
int n= in.nextInt();

int i,j;
int min=1;
int max=n;
for (i=1;i<=n/2;i++) {
for (j=1;j=min && j<=max){
System.out.print(" "+j+" ");

// break;
// continue;
}
else
System.out.print(" ");
}
min=min+1;
max = max-1;
System.out.println("");
}
if(n%2==0){
n++;
}
min=n/2;
max=n/2;
for (i=1;i<=n/2;i++) {
for (j=1;j=min && j<=max){
System.out.print(" "+j+" ");
// break;
// continue;
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 134/207
6/19/2019 20 Different Number Pattern Programs In Java

}
else
System.out.print(" ");
}
min=min-1;
max = max+1;
System.out.println("");
}
in.close();

****************************
*******
output is

1234
23
2
123

Reply

Ram
August 26, 2017 (11:38 am) #

can anybody write the code for


printing the below pattern
1 2 3 10 11 12
–4589
––67

Reply

austin
August 30, 2017 (7:16 am) #

tell me at what logic it was


printed…,i will try

Reply

ANKIT
June 5, 2018 (11:13 am) #

public class Pattern13 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 135/207
6/19/2019 20 Different Number Pattern Programs In Java

int n=3;
int c=n*(n+1),d=1;
int arr[]=new int [n];
for(int i=n;i>=1;i–)
{
for(int k=n;k>i;k–)
{
System.out.print(“- “);
}
int k=0;
for(int j=1;j<=i*2;j++)
{
if(j=0;j–)
System.out.print(arr[j]+” “);
System.out.println();
}
}

OUTPUT

1 2 3 10 11 12
–4589
––67

Reply

saptaparna basu
August 28, 2017 (3:28 pm) #

0
12
345
9876
543
21
0
help me

Reply

krishnaprasad
September 1, 2017 (2:56 pm) #

please give the code for given


pattern……….
input string:`12345
output:
15

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 136/207
6/19/2019 20 Different Number Pattern Programs In Java

24
3
42
51

Reply

arjun
September 4, 2017 (1:46 pm) #

#.#.#.#.#.#.#.#.#
#.#.#.#…#.#.#.#
#.#.#…….#.#.#
#.#………..#.#
#……………#
#.#………..#.#
#.#.#…….#.#.#
#.#.#.#…#.#.#.#
#.#.#.#.#.#.#.#.#

Reply

arjun
September 4, 2017 (1:47 pm) #

pleaz give the program for this


structure…its very difficult
#.#.#.#.#.#.#.#.#
#.#.#.#…#.#.#.#
#.#.#…….#.#.#
#.#………..#.#
#……………#
#.#………..#.#
#.#.#…….#.#.#
#.#.#.#…#.#.#.#
#.#.#.#.#.#.#.#.#

Reply

J Raviteja
September 5, 2017 (4:41 am) #

how to print it in java

12345
4321
123
21
1

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 137/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

pradeep
September 5, 2017 (11:51 am) #

how to print
1
23
345
4567
56789

Reply

arjun
September 7, 2017 (4:11 am) #

plz give me java program to print


this
9
98
876
7654
65432

Reply

pradeep
September 7, 2017 (7:47 am) #

1
23
345
456
56789
give the coding of this

Reply

puneet s m
September 7, 2017 (3:16 pm) #

how to get the following pattern


aaaaaaaaaaaaaaa
aaaaaa aaaaaaa
aaaaa aaaaaa
aaaa aaaaa
aaa aaa
aa aa

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 138/207
6/19/2019 20 Different Number Pattern Programs In Java

aaa aaaa
aaaaa aaaaaa
aaaaaa aaaaaaa
aaaaaaaaaaaaaaa

Reply

Vani
September 10, 2017 (5:35 pm) #

pls help me out with this


11
213
3216
4 3 2 1 10

Reply

Anonymous
September 10, 2017 (5:45 pm) #

please help me out


11
213
3216
4 3 2 1 10

Reply

jayaprakash
September 14, 2017 (7:43 am) #

Plz hlp
1
01
101
0101
I need java code

Reply

vamsi
September 14, 2017 (4:59 pm) #

Example Input: 5
Example Output:

*………*
**…….**
***…..***

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 139/207
6/19/2019 20 Different Number Pattern Programs In Java

****…****
*****.*****
***********
*****.*****
****…****
***…..***
**…….**
*………*

Reply

Kshitiz
September 15, 2017 (7:15 am) #

1
23
456
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28

program for this pattern

Reply

Kshitiz
September 15, 2017 (7:16 am) #

In JAVA language plzzz

Reply

Dhrumil
September 20, 2017 (9:57 am) #

1
232
34543
4567654
567898765

Reply

dhrumil
September 21, 2017 (3:05 pm) #

1234321
123*321
12***21

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 140/207
6/19/2019 20 Different Number Pattern Programs In Java

1*****1
12***21
123*321
1234321

Where * is spaces

Reply

Bat40
September 22, 2017 (7:30 pm) #

Did u find an answer to this from


somewhere??
If yes can u plz reply to my reply
below.its a separate reply given
below your reply.
plz write it for me!!!!

Reply

Eissa
September 22, 2017 (4:11 pm) #

Can anyone help me with this?


*****
**
*

Reply

Bat40
September 22, 2017 (7:22 pm) #

It is a legid Rectangle with a legid


diamond inscribed in it.
123454321
1234 4321
123 321
12 21
11
12 21
123 321
1234 4321
123454321

Can Anyone Please write a code


for this??
Any help will be appreciated!!

Reply
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 141/207
6/19/2019 20 Different Number Pattern Programs In Java

codeBreaker
October 2, 2017 (7:50 am) #

How to print this pattern:


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

Reply

TINY
October 2, 2017 (4:43 pm) #

HELP ME WITH THIS:


@
@@
@@@
@@@@
@@@@@

Reply

krish
October 4, 2017 (6:54 am) #

public static void m(){


for (int i = 1; i <=5; i++) //rows
{
for (int j = 1; j <=i; j++) //colums
{
if((i+j)%2==0) //it is checked odd
or even.if its odd number printing
1 orelse It has to print o//
{
System.out.print("1");

}else
System.out.print("0");

}
System.out.println();

}
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 142/207
6/19/2019 20 Different Number Pattern Programs In Java

dnyaneshwar
October 4, 2017 (8:49 pm) #

5
45
345
2345
12345
send the ans

Reply

varun
October 5, 2017 (6:32 pm) #

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

Reply

Dhruval
October 19, 2017 (2:56 am) #

public class Pattern {


public static void main(String[]
args) {
int n=4;// in your case

for (int i = 1; i <= n; i++) {


for (int j = 1; j = 1; i–) {
for (int j = 1; j <= i; j++)
System.out.print("*");

System.out.println();
}
}
}

Reply

Harsh
October 6, 2017 (4:57 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 143/207
6/19/2019 20 Different Number Pattern Programs In Java

please write a programme for this


pattern:
12345
22344
33345
44445
55555

Reply

anil
October 8, 2017 (9:45 am) #

please send solution for this


pattern
1
212
32123
4321234
32123
212
1

Reply

atul
October 8, 2017 (11:16 am) #

how to print pattern


123
234
456

Reply

bhanusai
November 23, 2017 (4:26 am) #

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter a n”);
int n =sc.nextInt();

for(int i=1;i<=n;i++){

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 144/207
6/19/2019 20 Different Number Pattern Programs In Java

for(int j=i;j<=i+2;j++){
int num=j;
System.out.print(num);
num++;
}

System.out.println("");

Reply

Niteesh Joshi
October 9, 2017 (11:30 am) #

11
12 21
123 321
1234 4321
12345 54321
123456 654321

send me the code for this pattern


please

Reply

bhanusai
November 21, 2017 (9:02 am) #

package com.progam;

import java.util.Scanner;

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter the
n”);
int n=sc.nextInt();

for (int i = 1; i<=n; i++) {

for(int j=1;j=1;j–){
System.out.print(j);

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 145/207
6/19/2019 20 Different Number Pattern Programs In Java

}
System.out.println(“”);
}

Reply

Ankit Soni
October 16, 2017 (5:40 pm) #

How to print this kind of pattern :-


1
23
456
7 8 9 10

Reply

Ankit Soni
October 16, 2017 (5:42 pm) #

1
23
456
7 8 9 10

Reply

Dhruval
October 19, 2017 (2:48 am) #

public class Pattern {


public static void main(String[]
args) {
int n = 4; // in your case.
int k = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(k + " ");
k++;
}
System.out.println();
}
}
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 146/207
6/19/2019 20 Different Number Pattern Programs In Java

Kshitij Shah
October 17, 2017 (3:16 pm) #

How to print a pattern like:


54321
4321
321
21
1

Reply

Dhruval
October 19, 2017 (2:45 am) #

public class Pattern {


public static void main(String[]
args) {
int n =5; // in your case
for (int i = 0; i = 1; j–) {
System.out.print(j + ” “);
}
System.out.println();
}
}
}

Reply

Dhruval
October 19, 2017 (2:58 am) #

Pasted it wrongly. Use this one


:
public class Pattern {
public static void main(String[]
args) {
int n =5; // in your case

for (int i = 0; i = 1; j–) {


System.out.print(j + ” “);
}
System.out.println();
}

}
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 147/207
6/19/2019 20 Different Number Pattern Programs In Java

Dhruval
October 19, 2017 (2:59 am) #

for (int i = 0; i = 1; j–) {


System.out.print(j + ” “);
}
System.out.println();
}

Reply

deep
October 28, 2017 (7:17 pm) #

0
00
000
0000
00000
000000
0000000
00000000
0000000
000000
00000
0000
000
00
0

Reply

deep
October 28, 2017 (7:18 pm) #

pls write java program

Reply

bhanusai
November 21, 2017 (8:58 am)
#

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated
method stub

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 148/207
6/19/2019 20 Different Number Pattern Programs In Java

Scanner sc = new
Scanner(System.in);
System.out.println(“enter the
n”);
int n=sc.nextInt();

for (int i = 1; i<=n; i++) {

for(int j=1;j=1;i–){
for(int j=1;j<=i;j++){
System.out.print(0);
}
System.out.println("");
}

Reply

Kartik
October 29, 2017 (1:52 pm) #

Wap to print the following pattern


school
schoo
scho
sch
sc
s

Reply

Sneha
October 31, 2017 (2:21 pm) #

How to print the pattern


121
1232
1234321
123454321
12345654321
1234567654321

Reply

bhanusai
November 13, 2017 (4:29 am) #

package com.progam;

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 149/207
6/19/2019 20 Different Number Pattern Programs In Java

import java.util.Scanner;

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter the
n”);
int n=sc.nextInt();
int num=1;
for (int i = 1; i<=n; i++) {

for (int j = 1; j =1; j–) {


System.out.print(j);
}
System.out.println(“”);
}

Reply

Rishi
November 5, 2017 (3:51 am) #

1112
3222
3334

I want code for this pattern??

Reply

bhanusai
November 10, 2017 (4:31 am) #

import java.util.Scanner;

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter the

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 150/207
6/19/2019 20 Different Number Pattern Programs In Java

n”);
int n=sc.nextInt();
int num=1;
for (int i = 1; i<=n; i++) {

if(i%2==1){
for(int j=1;j<=n-1;j++){
System.out.print(i);
}
System.out.print(i+1);
}
else{
System.out.print(i+1);
for(int j=1+1;j<=n;j++){
System.out.print(i);
}
}

System.out.println("");
}

Reply

Kushal jain
November 7, 2017 (3:36 pm) #

12345
6789
10 11 12
13 14
15

Reply

Sunny Singh
November 13, 2017 (8:23 pm) #

This should do it.

class Pattern{
public static void main(String…
args){
int k = 1;
for(int i = 5;i>=1;i–){
for(int j = 1;j<=i;j++){
System.out.print(k++);
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 151/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println();
}
}
}

Reply

Anirban
November 9, 2017 (8:54 pm) #

1
32
456
10 9 8 7

Reply

Hemangi
November 12, 2017 (6:23 pm) #

000000
011100
011100
011100
011100
000000
I want to find wheather pattern
consist of rectangle or not?if
consist print “Yes” and coordinates
like
11
4 2.
help me

Reply

bhanusai
November 21, 2017 (8:41 am) #

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter the

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 152/207
6/19/2019 20 Different Number Pattern Programs In Java

n”);
int n=sc.nextInt();

for (int i = 1; i<=n; i++) {


if((i==1)||(i==n)){
for(int j=1;j<=n;j++){
System.out.print(0);
}
}
else{
for(int j=1;j<=n;j++){
if((j==2)||(j==3)||(j==4)){
System.out.print(1);

}
else{
System.out.print(0);
}
}
}
System.out.println("");
}

Reply

Salgunan
November 15, 2017 (1:34 pm) #

How to display pattern:


11
123
1236
1 2 3 4 10
1 2 3 4 5 15

Reply

bhanusai
November 18, 2017 (4:36 am) #

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 153/207
6/19/2019 20 Different Number Pattern Programs In Java

Scanner(System.in);
System.out.println(“enter the
n”);
int n=sc.nextInt();

for (int i = 1; i<=n; i++) {


int s=0;
for(int j=1;j<i+1;j++){
System.out.print(j);
s=s+j;
}
System.out.print(s);
System.out.println("");
}

Reply

Elda varghese
November 22, 2017 (5:43 pm) #

anyone plz help me to sove this


pattern
1
234
56789

Reply

bhanusai
November 26, 2017 (5:30 am) #

public class Pattern3 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter n”);
int n =sc.nextInt();
int num=1;
for(int i=1;i<=n;i++){
if(i%2==1){
for(int j=1;j<=i;j++){
System.out.print(num);

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 154/207
6/19/2019 20 Different Number Pattern Programs In Java

num++;
}
System.out.println("");
}
}
}

Reply

Elda varghese
November 22, 2017 (5:45 pm) #

anyone plz help me to solve this


problem

—-1
—234
-56789

Reply

Divya
November 24, 2017 (9:14 am) #

1
11
212
4224
84448
code for this please!

Reply

Divya
November 24, 2017 (9:13 am) #

1
11
212
4224
84448
code for this please!

Reply

PVSS
July 15, 2018 (2:22 am) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 155/207
6/19/2019 20 Different Number Pattern Programs In Java

import java.util.*;
public class GGK2ndPattern{
public static void main(String[]
args) {
// TODO Auto-generated method
stub
int i,j,k,l;
Scanner sc = new
Scanner(System.in);
int n = sc.nextInt();
System.out.print(1+” “);
System.out.println();
int num=1;
int num1=1;
for(i=1;i<=n;i++){
for(j=0;j<=i;j++){
if(j==0 | j==i)
System.out.print(num+" ");
else
System.out.print(num1+" ");
}num1=num;
num=num*2;
System.out.println();
}
}
}

Reply

bhagyashree patil
November 24, 2017 (12:26 pm) #

1
21
321
4321
54321

can u help me for this code

Reply

J_dawg
November 24, 2017 (6:26 pm) #

how to print this?


cccc ddd ee f
cccc ddd ee

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 156/207
6/19/2019 20 Different Number Pattern Programs In Java

cccc ddd
cccc

Reply

bhanusai
November 26, 2017 (5:32 am) #

public class Pattern3 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter n”);
int n =sc.nextInt();
int num=1;
for(int i=1;i<=n;i++){
if(i%2==1){
for(int j=i;j<=n;j++){
System.out.print("_");
}
for(int j=1;j<=i;j++){
System.out.print(num);
num++;
}
System.out.println("");
}
}
}

Reply

Ankkona Das
November 26, 2017 (12:07 pm) #

11111
0000
111
00
1
Can anyone please solve this…If
anyone can thn plz solve it for
me..

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 157/207
6/19/2019 20 Different Number Pattern Programs In Java

bhanusai
November 28, 2017 (4:30 am) #

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter a n”);
int n =sc.nextInt();

for(int i=1;i<=n;i++){

if(i%2==1){
for(int j=i;j<=n;j++){
System.out.print(1);
}
}
else{
for(int j=i;j<=n;j++){
System.out.print(0);
}
}

System.out.println("");
}

Reply

tarun
November 27, 2017 (2:04 am) #

how to print
222
212
222

Reply

bhanusai
December 3, 2017 (5:55 am) #

package com.progam;

import java.util.Scanner;
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 158/207
6/19/2019 20 Different Number Pattern Programs In Java

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter a n”);
int n =sc.nextInt();
for(int i=1;i<=n;i++){

if(i%2==1){
for(int j=1;j<=n;j++){
System.out.print(2);
}
}
else{
for(int j=1;j<=n;j++){
if(j==1){
System.out.print(2);
}
}
for(int j1=1;j1<=n-1;j1++){
System.out.print(j1);
}

}
System.out.println("");
}
}

package com.progam;

import java.util.Scanner;

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println("enter a n");
int n =sc.nextInt();
for(int i=1;i<=n;i++){

if(i%2==1){
for(int j=1;j<=n;j++){

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 159/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.print(2);
}
}
else{
for(int j=1;j<=n;j++){
if(j==1){
System.out.print(2);
}
}
for(int j1=1;j1<=n-1;j1++){
System.out.print(j1);
}

}
System.out.println("");
}
}

package com.progam;

import java.util.Scanner;

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println("enter a n");
int n =sc.nextInt();
for(int i=1;i<=n;i++){

if(i%2==1){
for(int j=1;j<=n;j++){
System.out.print(2);
}
}
else{
for(int j=1;j<=n;j++){
if(j==1){
System.out.print(2);
}
}
for(int j1=1;j1<=n-1;j1++){
System.out.print(j1);
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 160/207
6/19/2019 20 Different Number Pattern Programs In Java

}
System.out.println("");
}
}

Reply

Nitesh
November 27, 2017 (2:26 pm) #

In pattern 2, if we enter rows


above 10 then it shows 3 extra 10,
why this is happening.. can
anyone resolve this problem.??
Like this given below..

1
22
333
4444
55555
666666
7777777
88888888
999999999
10 10 10 10 10 10 10 10 10 10
11 11 11 11 11 11 11 11 11 11 11

Reply

bhanusai
December 6, 2017 (4:26 am) #

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter a n”);
int n =sc.nextInt();
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
System.out.print(i+" ");
}
System.out.println("");

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 161/207
6/19/2019 20 Different Number Pattern Programs In Java

}
}
}

Reply

ayush
November 29, 2017 (8:39 am) #

M*****M

M*M*M*M

M**M**M

M*****M

M*****M
how to print above pattern?

Reply

aarthi
January 3, 2019 (6:46 pm) #

have you solved this problem ? if


so help me out with this.

Reply

ManjuVeena
December 1, 2017 (4:27 am) #

1
2332
456654
7 8 9 10 10 9 8 7

how to print this pattern using


java code??

Reply

Kruttichhwas
December 2, 2017 (5:03 am) #

Code for this


7777777
55555
333
1

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 162/207
6/19/2019 20 Different Number Pattern Programs In Java

bhanusai
December 5, 2017 (4:30 am) #

public class Pattern2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter a n”);
int n =sc.nextInt();
for(int i=n;i>0;i–){
if(i%2==1){
for(int j=1;j<=i;j++){
System.out.print(i);
}
}
System.out.println();
}

}
}

Reply

Gokul Kathirvel
December 5, 2017 (6:08 am) #

hello Kruttichhwas
class pattern {
public static void main(String[]
args) {

for(int i=7;i>=0;i-=2){

for(int j=1;j<=i;j++){

System.out.print(i);

}
System.out.println();
}
}
}

Reply

Gokul Kathirvel
December 6, 2017 (5:18 pm) #
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 163/207
6/19/2019 20 Different Number Pattern Programs In Java

class pattern {
public static void main(String[]
args) {

for(int i=7;i>=0;i-=2){

for(int j=1;j<=i;j++){

System.out.print(i);

}
System.out.println();
}
}
}

Reply

karthik
December 7, 2017 (4:27 pm) #

Hi i need a coding for this pattern


input 3
output
##*
*##
##*
and
inp 5
out
###**
##**#
#***#
****#
***##

Reply

BEGUM
December 12, 2017 (3:34 pm) #

HIII
I NEED CODE FOR THIS OUTPUT
1234567
123456
12345
1234
123
12
1

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 164/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

bhanusai
January 10, 2018 (6:29 am) #

public class Pattern1 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc= new
Scanner(System.in);
System.out.println(“enter n”);
int n=sc.nextInt();
for(int i=n;i>=0;i–){
for(int j=1;j<=i;j++){
System.out.print(j);
}
System.out.println(" ");
}
}

Reply

pankaj kumar
December 19, 2017 (3:46 pm) #

2
46
8 10 12
can you plz provide coe for this
pattern

Reply

Manikanta
December 21, 2017 (6:11 pm) #

enter number:
10
1 2 3 4 5 6 7 8 9 10
36 37 38 39 40 41 42 43 44 11
35 64 65 66 67 68 69 70 45 12
34 63 84 85 86 87 88 71 46 13
33 62 83 96 97 98 89 72 47 14
32 61 82 95 100 99 90 73 48 15

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 165/207
6/19/2019 20 Different Number Pattern Programs In Java

31 60 81 94 93 92 91 74 49 16
30 59 80 79 78 77 76 75 50 17
29 58 57 56 55 54 53 52 51 18
28 27 26 25 24 23 22 21 20 19

Program:
import java.util.*;
public class AB15 {
public static void main(String[]
args)
{
Scanner sc=new
Scanner(System.in);
System.out.println(“enter
number:”);
int n=sc.nextInt();
int
k=1,j=0,i=0,top=n,right=n,botto
m=0,left=0;
int arr[][]=new int[n][n];
for(int a=0;a<n/2;a++)
{
for(;j<top;j++)
{
arr[i][j]=k;
k++;
}
j–;i++;
for(;i=bottom;j–)
{
arr[i][j]=k;
k++;
}
j++;i–;
for(;i>left;i–)
{
arr[i][j]=k;
k++;
}
i++;j++;
top–;right–;bottom++;left++;
}
if(n%2!=0)
arr[i][j]=k;
for(int b=0;b<n;b++)
{
for(int c=0;c<n;c++)

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 166/207
6/19/2019 20 Different Number Pattern Programs In Java

{
if(arr[b][c]<10)
System.out.print(arr[b][c]+" ");
else if(arr[b][c]<100)
System.out.print(arr[b][c]+" ");
else
System.out.print(arr[b][c]+" ");
}
System.out.println();
//System.out.println();
}
}
}
OUTPUT:
enter number:
10
1 2 3 4 5 6 7 8 9 10
36 37 38 39 40 41 42 43 44 11
35 64 65 66 67 68 69 70 45 12
34 63 84 85 86 87 88 71 46 13
33 62 83 96 97 98 89 72 47 14
32 61 82 95 100 99 90 73 48 15
31 60 81 94 93 92 91 74 49 16
30 59 80 79 78 77 76 75 50 17
29 58 57 56 55 54 53 52 51 18
28 27 26 25 24 23 22 21 20 19

Reply

Aakash
January 15, 2018 (9:39 am) #

i want this code


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

Reply

Beatrix
December 31, 2017 (7:07 am) #

1
33
555

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 167/207
6/19/2019 20 Different Number Pattern Programs In Java

7777
99999
help need the code in java to form
the above pattern

Reply

shweta
December 31, 2017 (7:16 pm) #

Write the code to print the


following pattern.
11
1221
123321
12344321
1234554321
123456654321
12345677654321
123456787654321

Reply

Sridhar
January 1, 2018 (6:44 am) #

program for
**
** **
*** ***
**** ****
**********

Reply

Sridhar
January 1, 2018 (6:52 am) #

program for
**
** **
*** ***
**** ****
**********

Reply

praisy
January 2, 2018 (6:52 am) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 168/207
6/19/2019 20 Different Number Pattern Programs In Java

12345
4321
123
21
1
plz give the code

Reply

Arif Ali
January 8, 2018 (7:28 pm) #

class Demo
{
public static void main(String s[])
{
int i,j;
for(i=1; i<=5; i++)
{
for(j=i; j<=5; j++)
{
int x = 6-j;
if(i%2==0)
{
System.out.print(x);
}
else
{
for(int k=1; k<=6-i; k++)
{
System.out.print(k);
}break;
}
}
System.out.println("");
}
}
}

OUTPUT……………….
12345
4321
123
21
1

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 169/207
6/19/2019 20 Different Number Pattern Programs In Java

vijay
January 28, 2018 (8:04 am) #

Find the for loop

123
12
1

using 2 for loop only

Reply

vijay
January 28, 2018 (8:05 am) #

Find the for loop

123
12
1

using 2 for loop only

Reply

druvaasa
February 26, 2018 (5:05 pm) #

public class T12 {


public static void main(String[]
args) {
int n=3;
for(int i=1; i<=n; i++){
System.out.println("");
for(int j=1; j<=n-i+1; j++){
System.out.print(j);
}
}
}
}

Reply

manoj
February 2, 2018 (7:24 am) #

wap program print following


pattern
4321
4321

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 170/207
6/19/2019 20 Different Number Pattern Programs In Java

321
21
1

Reply

manoj
February 2, 2018 (7:25 am) #

wap program print following


pattern java
4321
4321
321
21
1

Reply

Mr.Grey
February 8, 2018 (1:56 pm) #

Input length and width: 5


ppppp
pp
pp
pp
ppppp

Using do while in java

Reply

Mr.Grey
February 8, 2018 (1:59 pm) #

Input length and width: 5


ppppp
pp
pp
pp
ppppp

Using do while in java

Reply

sumit rana
February 8, 2018 (2:04 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 171/207
6/19/2019 20 Different Number Pattern Programs In Java

how to print this?


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

Reply

sumit rana
February 8, 2018 (2:06 pm) #

how to print this?


44444
4444
444
44
4

Reply

DINESH M
February 22, 2018 (11:26 am) #

import java.util.*;
public class MyClass {
public static void main(String
args[]) {

for(int i=1;i=i;j–)
{
System.out.print(“4”);
}

System.out.println(“”);
}

}
}

Reply

sumit rana
February 8, 2018 (2:11 pm) #

how to print this?


244444
224444
222444

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 172/207
6/19/2019 20 Different Number Pattern Programs In Java

222244
222224

Reply

bhanusai
February 28, 2018 (6:44 am) #

package com.pattern;

import java.util.Scanner;

public class Pattren {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
Scanner sc = new
Scanner(System.in);
System.out.println(“enter n”);
int n=sc.nextInt();
for(int i=1;i<n;i++){
for(int j=1;j<=i;j++){
System.out.print(2);
}
for(int j=i+1;j<=n;j++){
System.out.print(4);
}
System.out.println("");
}
n–;

Reply

bhanusai
February 28, 2018 (3:03 pm) #

333
313
323
333

find above output for n=3

Reply

Abhay
March 3, 2018 (2:32 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 173/207
6/19/2019 20 Different Number Pattern Programs In Java

1111112
2333333
3333334
4555555
5555556
6777777
Can any one try the program for
this pattern ?

Reply

Venkatesh Shankar
March 4, 2018 (12:17 pm) #

*********
b*******b
bb*****bb
bbb***bbb
bbbb*bbbb

Reply

Karthik Agnihotram
March 4, 2018 (5:07 pm) #

how do i do these:-

i) double series(double a, double


n)
Sum= 1/a2+ 4/a5+ 7/a8+
10/a11+——————————– to
n terms.
ii) double series(double n)
Sum= (1*3)+(3*5)+(5*7)+
——————————— to n terms

Reply

Ankit kar
March 12, 2018 (8:45 am) #

pls help me in the following


programs
1
31
531
7531
97531

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 174/207
6/19/2019 20 Different Number Pattern Programs In Java

12345
6789
10 11 12
13 14
15

15 14 13 12 11
10 9 8 7
654
32
1

Reply

Sugyani Tripathy
March 25, 2018 (5:31 am) #

int l=15;
for(int i=5;i>=1;i–)
{
for(int j=1;j<=i;j++)
{
System.out.print(l);
l–;
}
System.out.println();
}

Reply

Tarun
March 20, 2018 (4:03 am) #

could u pls send the pattern for


this
12345
3579
8 12 16
20 28
48

Reply

Amit
March 21, 2018 (10:59 am) #

Sir How can I print patter like this


1/2 +3/4+5/6+7/8……………..

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 175/207
6/19/2019 20 Different Number Pattern Programs In Java

Aritro
March 22, 2018 (4:53 pm) #

Please help me with the following


program….
1
121
1331
14641
161051
**without using 2-D array

Reply

PVSS
July 15, 2018 (2:31 am) #

import java.util.*;
public class DoubtPattern {
public static void main(String[]
args) {
// TODO Auto-generated method
stub
int i,j;
Scanner sc = new
Scanner(System.in);
int n =sc.nextInt();
System.out.print(1+” “);
System.out.println();
int num=11;
int num1=num;
for(i=1;i<=n;i++){
num1=num1*num;
System.out.println(num1);
}
}
}

Reply

Pavithra
March 27, 2018 (2:07 pm) #

Can anybody help in solving this


plzzz……
2
333

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 176/207
6/19/2019 20 Different Number Pattern Programs In Java

55555
7777777
55555
333
2

Reply

subreen
April 18, 2018 (5:22 am) #

15
24
3
24
15
how do the program

Reply

subreen
April 18, 2018 (5:24 am) #

15
24
3
24
15

Reply

Mr Anonymous010
April 22, 2018 (7:59 am) #

FOR 11 IT COULD BE MORE


EASY::

class patt2
{ public static void main(String
args[])
{ patt2 o=new patt2();
int n=7,i,j;
for(i=1;i<=n;i++)
{ o.space(i-1);
for(j=i;j0;i–)
{ o.space(i-1);
for(j=i;j<=n;j++)
{ System.out.print(j+" ");
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 177/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println();
}
}
void space(int n)
{ for(int i=0;i<n;i++)
System.out.print(" ");
}
}

Reply

rajasekaran
May 10, 2018 (10:46 am) #

1654321
1165432
1116543
1111654
1111165
1111116
1111111

please i want the java program


below output

Reply

Shubham
May 22, 2018 (7:44 pm) #

class Main {
public static void main(String[]
args) {
int n=7;
for(int i=1;i<=n;i++)
{
for(int j=1;j=i;k–)
{
System.out.print(k);
}
System.out.println();
}
}
}

Reply

rajasekaran
May 10, 2018 (10:48 am) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 178/207
6/19/2019 20 Different Number Pattern Programs In Java

1654321
1165432
1116543
1111654
1111165
1111116
1111111

Reply

Anukanksha
May 28, 2018 (8:10 am) #

how do I get the following


pattern:-
_______a
_____a___a
___a___b___a
a__b___c___b__a
___a___b___a
_____a___a
_______a

Reply

Ujjwal
May 31, 2018 (4:59 am) #

Can you give me code for


1
11
121
1331
14641
1 5 10 10 5 1

Reply

Ujjwal
May 31, 2018 (6:36 am) #

public static void main(String


args[])
{
System.out.println(“1
11
121
1331

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 179/207
6/19/2019 20 Different Number Pattern Programs In Java

14641
1 5 10 10 5 1

“);
}

Reply

Arpita
June 1, 2018 (11:15 am) #

Please write the code for this-


54321
32154
21543
15432

Reply

ANKIT
June 5, 2018 (11:20 am) #

public class Pattern13 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
int n=3;
int c=n*(n+1),d=1;
int arr[]=new int [n];
for(int i=n;i>=1;i–)
{
for(int k=n;k>i;k–)
{
System.out.print(“- “);
}
int k=0;
for(int j=1;j<=i*2;j++)
{
if(j=0;j–)
System.out.print(arr[j]+” “);
System.out.println();
}
}

OUTPUT

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 180/207
6/19/2019 20 Different Number Pattern Programs In Java

1 2 3 10 11 12
–4589
––67

Reply

abhi
June 12, 2018 (1:05 pm) #

2
13
468
5791
24682

Reply

jamar
June 17, 2018 (6:24 am) #

012 012
012 012
012 012
345 345
345 345
345 345

Reply

kacey
June 17, 2018 (6:35 am) #

1 2 3 10 11 12 19 20 21
4 5 6 13 14 15 22 23 24
7 8 9 16 17 18 25 26 27

Reply

Kuche chandana
July 5, 2018 (5:17 am) #

*
**
***
****
Write code for this

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 181/207
6/19/2019 20 Different Number Pattern Programs In Java

Abhishek Aadi
August 19, 2018 (12:20 pm) #

public class MyClass {


public static void main(String
args[]) {
for(int i=1;i<=4;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print("*");
}
System.out.println();
}
}
}

Reply

Gihan Lavindu
July 5, 2018 (7:55 am) #

Please help me to print this


pattern…

1
22
000
1111
22222
000000

Reply

chandana
July 7, 2018 (11:03 am) #

how to print this


****–
–****
****–
–****

Reply

Nickey Singh
July 17, 2018 (5:51 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 182/207
6/19/2019 20 Different Number Pattern Programs In Java

*#######
######**
***#####
####****
****####
#####***
**######
#######*

public class MyClass {


public static void main(String
args[]) {
int temp=0;
for(int i=1;i<=4;i++){
if(i%2==0){
for(int j=1;j<=2*4-i;j++){
System.out.print("#");
}
for(int j=1;j<=i;j++){
System.out.print("*");
}
}
else{
for(int j=1;j<=i;j++){
System.out.print("*");
}
for(int j=1;j=1;i–){
if(i%2!=0){
for(int j=1;j<=2*4-i;j++){
System.out.print("#");
}
for(int j=1;j<=i;j++){
System.out.print("*");
}
}
else{
for(int j=1;j<=i;j++){
System.out.print("*");
}
for(int j=1;j<=2*4-i;j++){
System.out.print("#");
}
}
System.out.println();
}
}
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 183/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

kesava
August 6, 2018 (5:39 am) #

how to print like this


ex: room is very hot
first ignore the space instead of
spaces it replace with “! ” then
after reverse the string output will
become like this
=> toh !yr ev! si! moo r!

Reply

Rajat goel
August 7, 2018 (7:52 am) #

please write code for this pattern

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

Reply

T. Sandhya Rani
August 9, 2018 (9:45 am) #

1
29
3 8 10
4 7 11 14
5 6 12 13 15
can i get code for this

Reply

ankit jadav
December 28, 2018 (11:43 am)
#

import java.util.Scanner;
public class Demo {
public static void main(String
args[]) {
Scanner sc = new

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 184/207
6/19/2019 20 Different Number Pattern Programs In Java

Scanner(System.in);
System.out.println(“How many
rows you want in this pattern”);
int n = sc.nextInt();
int[][] spiral = new int[n][n];
int value = 1;
int minCol = 0;
int minRow = 0;
int maxRow = n – 1;
int tempValue=0;
for(int i=n;i>0;i–) {
tempValue=tempValue+i;
}
while (value <= tempValue) {
for (int i = minRow; i = minRow;
i–) {
spiral[i][minCol] = value;
value++;
}
minRow++;
minCol++;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j <= i; j++) {
System.out.print(spiral[i][j] +
"\t");
}
System.out.println();
}
}
}

Reply

sagar
August 11, 2018 (6:58 pm) #

****1
***21
**321
*4321
54321
can i get this code?

Reply

Sundeep
August 14, 2018 (8:13 pm) #
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 185/207
6/19/2019 20 Different Number Pattern Programs In Java

class Program
{
static void Main(string[] args)
{
Console.WriteLine(“Enter
Number”);
int num =
int.Parse(Console.ReadLine());

for(int i = 1; i<= num; i++)


{
int k = i;
for(int j = 1; j <= num; j++)
{
if (j <= num – i)
Console.Write("*");
else
Console.Write(k–);
}
Console.WriteLine();
}
Console.ReadKey();
}
}

Reply

Sundeep
August 14, 2018 (8:11 pm) #

class Program
{
static void Main(string[] args)
{
Console.WriteLine(“Enter
Number”);
int num =
int.Parse(Console.ReadLine());

for(int i = 1; i<= num; i++)


{
int k = i;
for(int j = 1; j <= num; j++)
{
if (j <= num – i)
Console.Write("*");
else
Console.Write(k–);
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 186/207
6/19/2019 20 Different Number Pattern Programs In Java

}
Console.WriteLine();
}
Console.ReadKey();
}
}

Reply

roshni
August 16, 2018 (7:50 am) #

BAAAA
BBAAA
BBBAA
BBBBA
plz help me with this pattern

Reply

Ravi Kumar
August 31, 2018 (1:53 pm) #

public class Pattern5 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub

/*
* BAAAA
* BBAAA
* BBBAA
* BBBBA
*/

int row=5;
for (int i = 1; i <= row; i++) {
for (int j = 1; j = i; k–) {
System.out.print(“A”);

}
System.out.println();
}

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 187/207
6/19/2019 20 Different Number Pattern Programs In Java

komal jaiswal
August 16, 2018 (12:11 pm) #

solve it
12345
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9

Reply

ankit
August 18, 2018 (1:53 pm) #

1
12 12
123 123 123
1234 1234 1234 1234
12345 12345 12345 12345

Reply

Rajat
August 19, 2018 (2:26 pm) #

solve this
ABCDEFGFEDCBA
ABCDEFFEDCBA
ABCDEEDCBA
ABCDDCBA
ABCCBA
ABBA
AA

Reply

Sana Dsouza
August 22, 2018 (10:12 am) #

Its fun decoding these patterns……

Reply

Jack
August 26, 2018 (5:41 pm) #

Hey can you help me out in


studying the logic of how to

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 188/207
6/19/2019 20 Different Number Pattern Programs In Java

Solve any pattern

Reply

Teza
September 8, 2018 (12:36 pm) #

1
23
345
4567

pattern for this

Reply

ananth prajval
September 11, 2018 (12:52 am) #

1
24
135
2467
13589
can some one please help me for
this pattern printing please its very
urgent

Reply

aher vishal
September 20, 2018 (5:22 pm) #

1
12
123
1234
12345

Reply

Shreyansh singh
October 8, 2018 (12:23 pm) #

Class pattern
{
public static void main()
int a,b;
System.out.println(“The
Pattern”);

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 189/207
6/19/2019 20 Different Number Pattern Programs In Java

for(a=1;a<=5;a++)
{
for(b=1;b<=a;b++)
System.out.print (b+" ");
System.out.println();
}
}
}

Reply

Vishal
September 20, 2018 (5:23 pm) #

1
12
123
1234
12345
can anyone solve this?

Reply

Clara
September 24, 2018 (8:09 pm) #

9
98
876
7654
65432

Reply

Avinash
October 5, 2018 (6:32 pm) #

public class pattern_exmp2 {


public static void main(String[]
args)
{
Scanner sc = new
Scanner(System.in);

System.out.println(“Enter the
value”);
int rows = sc.nextInt();
System.out.println(“Here is your
pattern”);

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 190/207
6/19/2019 20 Different Number Pattern Programs In Java

for (int i = 0; i 0; j–)


{
System.out.print(j+” “);
}
System.out.println();
}

}
}

Reply

Avinash
October 5, 2018 (6:34 pm) #

public class pattern_exmp2 {


public static void main(String[]
args)
{
Scanner sc = new
Scanner(System.in);

System.out.println(“Enter the
value:–”);
int rows = sc.nextInt();
System.out.println(“Here is your
pattern….!!!”);

for (int i = 0; i 0; j–)


{
System.out.print(j+” “);
}
System.out.println();
}

}
}

Reply

harshit
October 2, 2018 (2:32 am) #

import java.util.Scanner;

public class MainClass


{
public static void main(String[]
args)
{

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 191/207
6/19/2019 20 Different Number Pattern Programs In Java

Scanner sc = new
Scanner(System.in);

System.out.println(“Enter the
value:– “);
int rows = sc.nextInt();
System.out.println(“Here is your
pattern….!!!”);

for (int i = 1; i <= rows; i++)


{
for (int j = 1; j <= i; j++)
{
System.out.print(j+" ");
}
System.out.println();
}
sc.close();
}

Reply

Andrew Matlai
October 3, 2018 (7:03 pm) #

Can any1 help me plz


Print diz pattern
123456
234561
345612
456123

Reply

Sashmita Senapati
October 17, 2018 (7:36 am) #

011111
101111
110111
111011
111101
111110

Reply

Ihza Wirawan
October 22, 2018 (3:40 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 192/207
6/19/2019 20 Different Number Pattern Programs In Java

can anyone solve this?


10 10 10 10 10 10
11 11 11 11 11
12 12 12 12
13 13 13
14 14
15

Reply

Soham Ray
November 14, 2018 (3:16 pm) #

I THINK THIS WILL WORK:


public class Pattern
{
public static void main()
{
for(int k=1;k=1;z–){
System.out.print(k+9+” “);}
System.out.println();}

}
}

Reply

Utsav
October 28, 2018 (12:45 pm) #

can any one Print this pattern?


asked in placement exam
*@
**@@
***@@@
****@@@@
* * * * *@ @ @ @ @* * * * *
@@@@****
@@@***
@@**
@*

Reply

Ramesh
November 2, 2018 (6:09 pm) #

using System;
public class Program

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 193/207
6/19/2019 20 Different Number Pattern Programs In Java

{
public static void Main()
{
int
n=Int32.Parse(Console.ReadLine
());
for(int i=1;i<=n-1;i++)
{
for(int j=1;j<=i;j++)
Console.Write("* ");
for(int j=1;j=1;i–)
Console.Write(“* “);
for(int i=n;i>=1;i–)
Console.Write(“@ “);
for(int i=n;i>=1;i–)
Console.Write(“* “);
Console.WriteLine();
for(int i=n-1;i>=1;i–)
{
for(int j=i;j>=1;j–)
Console.Write(“@ “);
for(int j=i;j>=1;j–)
Console.Write(“* “);
Console.WriteLine();
}
}
}

Reply

YELRAH
November 15, 2018 (12:00 pm) #

can you help me how to code this


192837465
2837465
37465
465
5

Reply

JUNNY
November 21, 2018 (10:52 pm) #

how to code this? can someone


help me please? thanks
678

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 194/207
6/19/2019 20 Different Number Pattern Programs In Java

534
129

Reply

Puquiz troy
November 23, 2018 (1:23 am) #

can you write the code for this?

Problem:
Enter the # of rows: 3
Enter the # of columns: 4

Output:
1234
2468
3 6 9 12

Reply

pavan
January 9, 2019 (6:55 pm) #

public static void main(String


[]args)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=4;j++)
{
System.out.print(i*j+" ");
}
System.out.println();
}
}

Reply

Sayana Biswas
November 26, 2018 (1:02 pm) #

#@#@#
@#@#
#@#
@#
#
Can you please write the program
for this pattern?

Reply
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 195/207
6/19/2019 20 Different Number Pattern Programs In Java

Oppo
November 30, 2018 (2:49 pm) #

Can you please solve this


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

Reply

RISHABH KUMAR
December 4, 2018 (1:06 am) #

Can you please write code for


1
26
3 7 10
4 8 11 13
5 9 12 14 15

Reply

Katholla Rakesh
January 10, 2019 (4:27 pm) #

import java.util.*;
public class Test
{
public static void Pattern()
{
int i,j;
int k;
int n=5;
for(i=1; i<=n; i++)
{
k=i;
for(j=1; j<=i; j++)
{
System.out.print(k+" ");
k=k+n-j;
}
System.out.println();
}

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 196/207
6/19/2019 20 Different Number Pattern Programs In Java

}
public static void main(String
args[])
{
Scanner sc=new
Scanner(System.in);
int n=sc.nextInt();
Test t=new Test();
t.Pattern();
}
}

Reply

Chandan Keshri
December 4, 2018 (11:53 am) #

Can you please write code for


*
12
***
2468
*****
3 6 9 12 15 18
*****
4 8 12 16
****
5 10 15
***
6 12
*

Reply

Sombarna Saha
December 6, 2018 (2:15 am) #

plz say the code for the following


output:-
1
22
111
2222
11111

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 197/207
6/19/2019 20 Different Number Pattern Programs In Java

Manu
December 7, 2018 (9:08 am) #

int N = 5;

1*2*3*4*5
11*12*13*14*15
21*22*23*24*25
16*17*18*19*20
6*7*8*9*10

Reply

Sreenivasulu
December 15, 2018 (2:57 pm) #

For the given pattern below, I


tried in this way:

1111111
1111122
1111333
1114444
1155555
1666666
7777777

Ans:
public class
PrintSequenceOfNumber2 {

public static void main(String[]


args) {
// TODO Auto-generated method
stub
for (int i = 1; i 1) {
for (int k = 1; k <=
timesToRepeatOne; k++) {
System.out.print(1);
}
for (int l = 1; l <= 7 –
timesToRepeatOne; l++) {
System.out.print(i);
}
} else {
for (int j = 0; j <=
timesToRepeatOne; j++) {
System.out.print(1);
}
}
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 198/207
6/19/2019 20 Different Number Pattern Programs In Java

System.out.println();
}

Could anyone suggest, is there


any other way to optimize this
code

Reply

Mayank
February 10, 2019 (4:18 pm) #

public class Patterns {

public static void main(String[]


args)
{
for (int i=1; i<=7; i++)
{
for (int j=1 ;j<=7; j++)
{
if(j<=7-i)
System.out.print("1");
else
System.out.print(i);
}
System.out.println();
}

Reply

Naftina
December 18, 2018 (10:17 am) #

please tell me how can i find the


sum of this series

a^2/x! + a^6/y! + a^10/x! +


………+ a^22/y!

Reply

ewrrq
December 22, 2018 (2:44 pm) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 199/207
6/19/2019 20 Different Number Pattern Programs In Java

how to print this series without


scanner class
5
54
543
5432
54321

Reply

somen
January 14, 2019 (9:35 am) #

Use a for loop

Reply

swarnendu mitra
December 23, 2018 (7:02 am) #

plese help
5432112345
4321 1234
321 123
21 12
11
11
21 12
321 123
4321 1234
5432112345

Reply

Shrivatsa Trivedi
December 24, 2018 (6:15 pm) #

need the following java code


asap.please.
*
*$*
**$**
***$***
****$****
*****$*****
$
$
$$ $

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 200/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

Renu
January 2, 2019 (7:30 am) #

1234
5006
7008
9123

plz solve this??????

Reply

SR
January 5, 2019 (7:44 am) #

12345
21234
32123
43212
54321

pls help quick

Reply

M.a
January 8, 2019 (3:45 pm) #

Please help me how to code this


Input:1
Output: 0
Next
Input : 2
Output:
0
010
01

Reply

Sanjeet sahu
January 17, 2019 (7:36 am) #

Please write this programme


2
25
2 5 10
https://javaconceptoftheday.com/number-pattern-programs-in-java/ 201/207
6/19/2019 20 Different Number Pattern Programs In Java

2 5 10 17
2 5 10 17 26

Reply

Ragul
January 19, 2019 (6:01 am) #

1
28
3 9 14
4 10 15 19
5 11 16 20 23
6 12 17 21 24 26
7 13 18 22 25 27 28

Reply

ganesh
January 21, 2019 (1:18 pm) #

12321
232
3

Reply

sara
January 24, 2019 (8:37 pm) #

AAAA
BBBB
CCCC
DDDD

Reply

Pratik Raj
January 28, 2019 (2:59 pm) #

Can anyone print the following


pattern in Java?
*
**
**
**

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 202/207
6/19/2019 20 Different Number Pattern Programs In Java

Srikanth Konuparthi
February 17, 2019 (6:47 pm) #

Output: (chain form of numbers)


000
1111
22
3333
444
5555
66
7777
888

anybody try to reduce this code?

class Test{
public static void main(String
args[]){
for(int i=0;i<=8;i++)
{
for(int j=0;j<=8;j++)
{
if(i==j||i+j==8||i+j==4||i-
j==4||j-i==4||i+j==12)
{
System.out.print(" "+i);
}
else
{
System.out.print(" ");
}
}
System.out.println();
}}}

Reply

Marque Rodin
February 21, 2019 (5:05 pm) #

1
2
3
4
5
Not sure how to do this one

Reply

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 203/207
6/19/2019 20 Different Number Pattern Programs In Java

Vishakha
March 1, 2019 (4:11 pm) #

How to print a program like this


1
21
321
4321
54321

Reply

Ganzo
May 19, 2019 (6:44 am) #

class pattern
{
public satic void main(Strings[]
args)
{
int a=1;
for(int i=1;i=1;j–)
{
System.out.print(j);
}
System.out.println();
a++;
}
}
}

Reply

Renuka Das
March 2, 2019 (10:55 am) #

Can anyone print the following


pattern in Java?
1
24
366
4 6 12 8

Reply

Biswarup Sarkar
March 9, 2019 (3:37 am) #

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 204/207
6/19/2019 20 Different Number Pattern Programs In Java

Can someone print this program


1
2
3
4
12345

Reply

Kumar b
March 12, 2019 (6:44 am) #

Hi I need out put like a-b-c can


some please provide logic for this.

Reply

Arjya paul
March 20, 2019 (6:31 am) #

please do this program for me


1
1001
100001
10000001

Reply

Jahanzeb
April 17, 2019 (4:26 pm) #

*****
****
***
****
*****
please this program

Reply

manohari
June 12, 2019 (6:35 am) #

*
***
*****
***
*
Solve this one…

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 205/207
6/19/2019 20 Different Number Pattern Programs In Java

Reply

DEBANJAN KHAN
June 15, 2019 (7:12 pm) #

PLEASE HELP ME TO DO THIS


STRING PATTERN
12345
12341
12312
12123
11234

PLEASE IT IS VERY URGENT FOR


ME…GIVE ME THE SOLUTION AS
SOON AS POSSIBLE

Reply

Butoi Alin
June 19, 2019 (10:16 am) #

How to print below pattern?


11111
2111
221
311
32
41
5

Reply

Leave a Reply

Your email address will not be


published. Required fields are
marked *
Comment

Name * Email * Website

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 206/207
6/19/2019 20 Different Number Pattern Programs In Java

Post Comment

Java Concept Of The Day © 2019 | About Us | Privacy Policy | Contact Us

https://javaconceptoftheday.com/number-pattern-programs-in-java/ 207/207

Potrebbero piacerti anche