Creating Number Patterns In Java

Creating Number Patterns In Java

Number Pattern in Java
Creating number or symbol patterns is used to check command of a programmer or a student on for loop. In short its done just for practicing for loop.


Here are some common number patterns :

Pattern 1. 
Pattern 1
To Print this pattern use the following code:

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

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

Pattern 2. 
Pattern 2
To Print this pattern use the following code:

public class numPtr {
    public static void main( String arg[]){
            for(int i=1;i<=5;i++){
            for(int j=5;j>=i;j--){
                System.out.print(j);
            }
            System.out.println();
        }
    }
}

Pattern 3. 
Pattern 3
To Print this pattern use the following code:
public class numPtr {
    public static void main( String arg[]){
           for(int i=1,r=5;i<=5;i++,r--){
            for(int j=1;j<=r;j++){
                System.out.print(j);
            }
            System.out.println();        }
    }
}

Pattern 4. 
Pattern 4
To Print this pattern use the following code:
public class numPtr {
    public static void main( String arg[]){
int ck=0,c=2;
        while(c>0){
        if(ck==0){
            for(int i=1;i<=5;i++){
            for(int j=1;j<=i;j++){
                System.out.print(j);
            }
            System.out.println();         }
            ck++;
       } else{
            for(int i=1,r=5-1;i<=5-1;i++,r--){
            for(int j=1;j<=r;j++){
                System.out.print(j);            }
            System.out.println();
        }
        }
        c--;
      }

    }
}

Pattern 5. 

Pattern 5
To Print this pattern use the following code:
public class numPtr {
    public static void main( String arg[]){
int ck=0,c=2;
        while(c>0){
        if(ck==0){
            for(int i=1,r=5;i<=5;i++,r--){
            for(int j=1;j<=r;j++){
                System.out.print(j);
            }
            System.out.println();        }
            ck++;
       } else{
            for(int i=2;i<=5;i++){
            for(int j=1;j<=i;j++){
                System.out.print(j);            }
            System.out.println();
        }
        }
        c--;
      }

    }
}
Author Note: All the above examples gives output till 5, you can change it accordingly by changing the conditions. 

1225 Comments Leave new

«Oldest   ‹Older   1001 – 1200 of 1225   Newer›   Newest»

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

class Pattern
{

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

}
}
}

Reply

Please help me create a code that will display exactly this:
1 = 1
1 + 2 = 3
1 + 2 + 3 = 6
1 + 2 + 3 + 4 = 10
1 + 2 + 3 + 4 + 5 = 15
1 + 2 + 3 + 4 + 5 + 6 = 21
1 + 2 + 3 + 4 + 5 + 6 + 7 = 28
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 36
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55

Reply

Hi ,can u plz help me out with this program?
A java program to print the series 3 3 4 8 10 30 33 upto n terms?

Reply

sir can u write java program for
12345 54321
1234 4321
123 321
12 21
1 1
1 1
12 21
123 321
1234 4321
12345 54321

Reply

Program for
12345 54321
1234 4321
123 321
12 21
1 1
1 1
12 21
123 321
1234 4321
12345 54321


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

System.out.print(" ");m--;

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

for(int k=1;k<=n;k++)
{ int a=1;

for(int p=1;p<=k;p++)
{
System.out.print(a);a++;
}

System.out.print(" ");a--;

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

Reply
This comment has been removed by the author.

Can you do this pattern please?
*********
*********
*********
*********

Reply

class DEmo3
{
public static void main(String[] args)
{
int n=7;
int k=n/2+1;
for(int i=1;i<=n;i++)
{

if(i<=n/2)
{
for(int j=4;j>=i;j--)
{


System.out.print(k);

}
k--;
}
else{
for(int l=1;l<=k;l++)
{
System.out.print(k);
}
k++;
}
System.out.println();
}
}
}

Reply

Program for
*********
*********
*********
*********

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

Reply

Sir can u please help me out with this problem

7
14 15
28 29 30 31
56 57 58 59 60 61 62 63

Reply

print series for 7,10,8,11,9,12

Reply

print series for 7,10,8,11,9,12

Reply
This comment has been removed by the author.

Program for
7
14 15
28 29 30 31
56 57 58 59 60 61 62 63


public class Pattern
{
public static void main(String[] args)
{
int n=7, m=1;
for(int i=1;i<=4;i++)
{
for(int j=1;j<=m;j++)
{ int p=n;
p=p+j-1;
System.out.print(p+" ");
}
System.out.println("");
m *=2;
n *=2;
}
}
}

Reply

please help me with the following code
1
2*3
4*5*6
7*8*9*10
4*5*6
2*3
1

Reply

10
10 9
10 9 8
10 9 8 7
10 9 8 7 6
and so on, i was hoping you could tell me how to do this with user input

Reply

10
10 9
10 9 8
10 9 8 7
10 9 8 7 6
and so on, i was hoping you could tell me how to do this with user input

Reply

sir.. plz solve this problem

i/p=number of rows/columns

pattern is:
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9







Reply

May i know the code of this pattern pleasee
4 4 4 4
4 4 4 4
4 4 4 4
4 4 4 4

Reply

Program for
10
10 9
10 9 8
10 9 8 7
10 9 8 7 6

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

Reply

Program for
4 4 4 4
4 4 4 4
4 4 4 4
4 4 4 4

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


Reply

Can you provide the code for printing the below pattern:
1*2*3*4
9*10*11*12
13*14*15*16
5*6*7*8

Reply

Hello

private static void squarePattern( int input )
{
String evencount = "" , oddcount = "" ;
int initialVal = 1 ;
for ( int count = 1; count <= input; count++ )
{
String rowValue = "" ;
if ( count % 2 != 0 )
{
for ( int oddcounter = 1; oddcounter <= input; oddcounter++ )
{
rowValue = rowValue + initialVal + "*" ;
initialVal++ ;
}
rowValue = rowValue.substring( 0, ( rowValue.length() - 1 ) ) + "\n" ;
oddcount = oddcount + rowValue ;
}
else
{
for ( int evencounter = 1; evencounter <= input; evencounter++ )
{
rowValue = rowValue + initialVal + "*" ;
initialVal++ ;
}
rowValue = "\n" + rowValue.substring( 0, ( rowValue.length() - 1 ) ) ;
evencount = rowValue + evencount ;
}
}
System.out.println( "\n\nMatrix is :\n" + oddcount + evencount.substring( 1 ) ) ;
}

Reply

Sir i need output as we give input as
1 2 3
4 5 6
7 8 9
output as
1 2 3
8 9 4
7 6 5

Reply
This comment has been removed by the author.
This comment has been removed by the author.

what will be the code from numbers pattern in triangle
1
121
12321
1234321

Reply

Kindly please tell me the pattern of this code
3
33
333

Reply

Sir please kindly tell me the code for this pattern
3
333
3

Reply

123454321
12344321
123321
1221
11
Hi Nirvana, Please solve this soon. It is urgent.

Reply

Can you merge the two Patters like (Please post the answer as fast as you can,Thank You)
1######
12#####
123####
1234###
12345##
123456#
1234567

Reply

*****
* *
* *
* *
* *
*****
sir give me this code pls....!

Reply

Please tell me how to create the pattern 123
246
369 By the nested for loop

Reply
This comment has been removed by the author.

what is the code for this out put below?
like this
NO Odd Numbers
1 1
2 1 3
3 1 3 5

Reply

Can you give me the code for
1
1 2
1 2 3
1 2 3 4

Reply
This comment has been removed by the author.

Hi Arun,
Here's the code:
for (int i = 1; i < 5; i++){
for(int j = 1; j <= i; j++){
System.out.print(j+" ");
}
System.out.println("");
}

Reply

how to write a program for star pattern like:
* *
* *
* *
*
* *
* *
* *

Reply
This comment has been removed by the author.

I want a program that counts the number of continuous alphabet and no. of vowel pairs.
For e.g. The ghost is waiting quietly for Ram in deep silence.
alphabet pairs: gh,ab, hi, st etc.
vowel pairs : ai,ui etc.

Reply

1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25

Reply

what will be the simple bluej code for:
1
12
123
1234
12345
1234
123
12
1

Reply

public class pattern
{
public static void main()
{
int i,j,k;
for(i=1;i<=9;i+=2)
{
for(j=i;j<=9;j+=2)
{
System.out.print(j);
}
for(k=1;k<=(i-1);k+=2)
{
System.out.print(k);
}
System.out.println();
}
}
}

Reply

public class pattern10
{
public static void main()
{
int i,j,k;
for(i=1;i<=9;i+=2)
{
for(j=i;j<=9;j+=2)
{
System.out.print(j);
}
for(k=1;k<=(i-1);k+=2)
{
System.out.print(k);
}
System.out.println();
}
}
}

Reply

please help to get codes fot the following pattern
1
12
123
1234
12345
123456


B;
123456
12345
1234
123
12
1


C;
1
21
321
4321
54321
654321

D;
123456
12345
1234
123
12
1

Reply

how to print this pattern:
9 8 7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
7 6 5 4 3 2 1
6 5 4 3 2 1
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1

Reply

how to print this pattern:
9 8 7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
7 6 5 4 3 2 1
6 5 4 3 2 1
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1

Reply

plzz code for this pattern
ABCDEDCBA
ABCD*DCBA
ABC***CBA
AB*****BA
A*******A
AB*****BA
ABC***CBA
ABCD*DCBA
ABCDEDCBA

Reply

plzz code for this pattern
ABCDEDCBA
ABCD*DCBA
ABC***CBA
AB*****BA
A*******A
AB*****BA
ABC***CBA
ABCD*DCBA
ABCDEDCBA

Reply

can u plzz hlep me in printing the following pattern
1
2 3
4 5 6
7 8 9 10

Reply

Sir give me code for the following pattern
1
1 2
1 2 4
1 2 4 8
1 2 4 8 16...

Reply

Can you please help me to print this pattern
1 2 3 4 5 6 7 8
1 2 3 4 5 6
1 2 3 4
1 2

Reply

Can you please help me to print this pattern
1 2 3 4 5 6 7 8
1 2 3 4 5 6
1 2 3 4
1 2

Reply

Please help me of this pattern
12345678
1234567
123456
12345
1234

Reply

how to print the program of
1
31
531
7531
9753

Reply

How to create pattern :
1 1
1 2 2 1
1 2 3 3 2 1
1 2 3 4 3 2 1

Simple for loop code please

Reply

can you please write a code for the following pattern using 2D array?
0
1 2
3 4 5
6 7 8 9

Reply

please give me the code for
1
21
321
4321
54321

Reply

12345678
43218765
23456789
54329876
345678910
654310987

Reply

What will be the code for this patetrn:

1
10
101
1010
10101

Reply

can U code this output I badly need it thanks!
.....1
....21
...321
..4321
.54321
654321

Reply

how about
- - - - 1
- - - 2 1
- - 3 2 1
- 4 3 2 1
5 4 3 2 1
and
- - 1
- 2 1 2
3 2 1 2 3
- 2 1 2
- - 1
lastly
1 2 3 4 5
2 - - - 4
3 - - - 3
4 - - - 2
5 4 3 2 1

Reply

how about
- - 1
- 2 1 2
3 2 1 2 3
- 2 1 2
- - 1

and
- - - - 1
- - - 2 1
- - 3 2 1
- 4 3 2 1
5 4 3 2 1

lastly

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

Reply

Hi my name is KSHITIJ TYAGI


Please help me printing this pattern
ABCDEEDCBA
ABCD DCBA
ABC CBA
AB BA
A A

Reply

1
1 1
1 0 1
1 1 1 1
1 1 1 1 1 how to print this pattern in java

Reply

Hi my name is KSHITIJ TYAGI

Please help me how to print this pattern

ABCDEEDCBA
ABCD--DCBA
ABC----CBA
AB------BA
A--------A

Reply

Two test cases are when I enter

1) input-3
333
313
323
333

2)input-5
55555
55155
55255
55355
55455
55555

Reply
This comment has been removed by the author.

Hi Please send code for below pattern
a
a b a
a b c b a
a b a
a

thanks

Reply

plz send this
#
0 #
# 0 #
0 # 0 #
# 0 # 0 #

Reply

How can I make this program
123454321
1234 4321
123 321
12 21
1 1

Reply

Java code for this pattern..
12345
12341
12312
12123
11234

Reply

public class Patterns
{
public static void main(String[] args)
{
int x=1,y=6,z=10;
for(int i=1;i<=3;i++)
{
for(int j=1;j<=i;j++)
{
if(j==1)
{
System.out.print(x);
x++;
}
else if(j==2)
{
System.out.print(y);
y++;
}
else
{
System.out.print(z);
z++;
}
}
System.out.println();
}
}
}

Reply

1
2 4
1 3 5
2 4 6 8
1 3 5 7 9
please solve this

Reply

HELLO I AM ANU AND I'D LIKE SOLUTION PROGRAM FOR GIVEN 2 PATTERNS

1) INPUT 3

1 1 1 1 1
1 2 2 2 1
1 2 3 2 1
1 2 2 2 1
1 1 1 1 1

2) INPUT 4

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

Reply

Please help with this pattern:::

If(3)
1*2*3
7*8*9
4*5*6

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

If(5)
1*2*3*4*5
11*12*13*14*15
21*22*23*23*25
16*17*18*19*20
6*7*8*9*10

Reply

plz draw this pyramid

1 1
22 22
333 333
4444 4444
55555 55555

Reply

Please can you help me with the code of this pattern 1
1 2 1
1 2 4 2 1
1 2 4 16 4 2 1

Reply

Please help me in getting the out put as

NewYear-2017-1111
NewYear-2017-1112
Newyear-2017-1113
NewYear-2017-1114
NewYear-2017-1115
.
.
.
.
.
.
.
NewYear-2017-9999

Reply

Pattern for
*****
*123*
*456*
*789*
*****

Reply

Pattern for
*****
*123*
*456*
*789*
*****

Reply

Pattern for
*****
*123*
*456*
*789*
*****

Reply

Pattern for
*****
*123*
*456*
*789*
*****

Reply

what a complex & mathmetical logic bro... tell me honestly how you took to create this :P

Reply

really complex one bro, kudos for this.. tell me honestly, how much time you took to create this logic ??

Reply

How to print the following ?
a
aba
abcba
aba
a

Reply

can u help me with this pattern
1
2 4
3 5 7
6 8 10 12

Reply

how to print the pattern

11
121
1331
14641

Reply

I need help with this...
1******
12*****
123****
1234***
12345**
123456*
1234567

Could you please help me in this ?

Reply

1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1


how could i solve this

Reply

0
1 1
2 3 5
8 13 21 34
solve this please

Reply

11
12 22
13 23 33
14 24 34 44
15 25 35 45 55
What will be its coding

Reply

11
12 22
13 23 33
14 24 34 44
15 25 35 45 55
What will be its coding

Reply

plz solve ths pattern to print..

1
2 3
6 5 4
7 8 9 10

Reply

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

Reply

class SystemDemo{
public static void main(String [] args){
int k =1;
for(int i =4; i > 0; i--){
for(int j =4; j >= i;j--){
System.out.print(k+" ");
k=k+1;
}

System.out.println();
}
}
}

Reply

sir do you even help with series or sum of series

Reply

HOW TO PRINT THIS
1
2 3
4 5 6
7 8 9 10
11 12 13 14

please reply

Reply

here's your code:-
import java.util.Scanner;
class Ques4{
public static void main(String [] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter number of rows =");
int rows = input.nextInt();
int val = 1;
for(int i = rows ; i >= 0 ; i--){
for(int j = rows ; j > i;j-- ){
System.out.print(val+ " ");
val = val +1;
}
System.out.println();
}
}
}

Reply

please help to get this pattern..
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1

Reply

How to print the series
1
2 6
3 7 10
4 8 11 13
5 9 12 14 15

Reply

public class patternnumberexample15 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int count=1;
for(int i=1;i<=9;i+=2){
count=i;
for(int j=1;j<=9;j+=2){

if(count<=9){
System.out.print(count);
count=count+2;
}else{
count=1;
System.out.print(count);
count=count+2;
}
}
System.out.println();

}

}

}

Reply
This comment has been removed by the author.

using recursive method and not with loops

If n=3, make a pattern like this

--1
2 3 4
--5

if n=5

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

Reply

INPUT:Enter any String of odd length:PHYSICS
OUTPUT SHOULD BE:
P
H
Y
P H Y S I C S
I
C
S
SIr plzz help me out!!!!

Reply

INPUT:Enter any String of odd length:PHYSICS
OUTPUT SHOULD BE:
P
H
Y
P H Y S I C S
I
C
S
SIr plzz help me out!!!!

Reply
This comment has been removed by the author.

It has a simple logic.
for(i=1;i<=5;i++)
{
for(j=i;j<=5;j++)
{
System.out.print(j+" ");
}
System.out.println();
}

Reply

2.Write a program to print the following triangle of numbers:

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

*can you please help me

Reply

Sir, what would be the program for this?

3 4 6 8 9
12 15 16 18 20
21 24 27 28 30
32 33 36 39 40

Reply

Can you please solve this problem. That if 3 is provided the printed pattern would be

333
313
323
333

And for 5 it would be

55555
55155
55255
55355
55455
55555?

Reply

Can you please solve this problem. That if 3 is provided the printed pattern would be

333
313
323
333

And for 5 it would be

55555
55155
55255
55355
55455
55555?

Reply
This comment has been removed by the author.

How to display this output ?
1
2 3
4 5 6
7 8 9 10

Reply

How to display this output ?

1
2 3
4 5 6
7 8 9 10

Reply

How to print this pattern?
12345
6789
101112
1314
15

Reply
This comment has been removed by the author.

*****
***
**
*
**
***
*****
pls write the code above pattren

Reply

what will be the code for
aAbBcCdD
AaBbCc
aAbB
Aa

Reply

import java.util.*;
public class logicprogram {

public static void main(String[] args) {
String name="amit is a good boy";
String split[]=name.split(" ");
for(int i=0;i<4;i++){
for(int j=0;j<split.length;j++){
String charcut=split[j];
if(charcut.length()<=i)
System.out.print("*");
else
System.out.print(charcut.charAt(i));
}
System.out.println();
}

}

}

Reply
This comment has been removed by the author.

Can you please tell the code for this pattern sir??
Thanks Before

_________0
_______1 2 3
_____2 3 4 5 6
___3 4 5 6 7 8 9
4 5 6 7 8 9 10 11 12
___3 4 5 6 7 8 9
____2 3 4 5 6
______1 2 3
________0

Reply

1
11
111
1111
11111
what is the code??

Reply
This comment has been removed by the author.

Hi I was wondering if you could show me how to program this including the words:
PatternA
1
12
123
1234
12345
123456

PatternB
123456
12345
1234
123
12
1

PatternC
1
21
321
4321
54321
654321

PatternD
123456
12345
1234
123
12
1

Thanks!

Reply

sir can u pls help me for dis pattern...

12345
12344
12335
12245
11345

Reply

sir can u pls help me for dis pattern...

12345
12344
12335
12245
11345

Reply

sir can u pls help me for dis pattern...

12345
12344
12335
12245
11345

Reply

how to print

*****
***
*
***
*****
Please tell me urgent

Reply

code for the following:
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5

Reply

what will be code for
1234567

12345
123
1

Reply
This comment has been removed by the author.

please help me with this:
---------1
--------1 1
-------1 2 1
------1 2 2 1
-----1 2 3 2 1
----1 2 3 3 2 1
---1 2 3 4 3 2 1

Reply

Please give me the code for the following pattern, please!
1
121
12321
121
1

Reply

Please give me the code for the following pattern, please!
1
121
12321
121
1

Reply

Please give me the code for the following pattern, please!
1
121
12321
121
1

Reply

what will be the program for the following pattern:
1
1 1
1 2 1
1 3 3 1

Reply

can u please help me to solve this particular program:

1
1 1
1 2 1
1 3 3 1

Reply

123
234
345
456
567
678
789
pls send the code for this

Reply

123456789
1234567
12345
123
1

Reply

Can u give program for
1
1 3
1 3 3 and

1
2 4
4 6 8 and

1
5 5
10 10 10

Reply

Can u give program for
1
1 3
1 3 3 and

1
2 4
4 6 8 and

1
5 5
10 10 10

Reply

send me the code for this pattern
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25

Reply

send me the code for this pattern
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25

Reply

Help me

ABCDE
ABCDA
ABCAB
ABABC
AABCD

Reply

Help me

ABCDE
ABCDA
ABCAB
ABABC
AABCD

Reply

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

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

System.out.print(j);
}
for(k=i; k>=1; k--)
{

System.out.print(k);

}


System.out.println();
}
}
}

Reply

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

Reply

please tell me the program to generate the series
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1

Reply

Sir please help me with these two patterns

1)
11111
2222
333
44
5

2)
5
44
333
2222
11111

Reply

Can u give the code for this pattern??
123456789
12345
123
1

Reply

Can u give the code for this pattern??
123456789
12345
123
1

Reply

Can u give the code for this pattern??
123456789
12345
123
1

Reply

Can u give the code for this pattern??
123456789
12345
123
1

Reply

Can u give the code for this pattern??
123456789
12345
123
1

Reply

Can u give the code for this pattern??
123456789
12345
123
1

Reply

What will be solution for this one?
1
11
202
3003

Reply

Plz give me this code

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

Reply
This comment has been removed by the author.

for(int i=0;i<=12;i++)
System.out.println(i+"----"+(i%4));

Reply

what was the program for this pattern?
1
2 6
3 7 10
4 8 11 13
5 9 12 14 15

Reply

wap to draw a pattern
*****
* *
* *
*****

Reply

1
1 2
3 4 5
12 13 14 15
54 55 56 57 58

Reply

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

can you please send me the code

Reply

! ! ! ! ! ! ! ! ! ! ! ! ! !
\\! ! ! ! ! ! ! ! ! !//
\\\\! ! ! ! ! !////
\\\\\\! !//////

HOW TO PRINT LIKE ABOVE ANY GUIDANCE PLEASE.
I GOT THIS IN MY INTERVIEW QUESTION. IF ANY BODY CAN SOLVE THIS THEN IT WILL BE MORE HELPFUL TO ME.
\\\\\\\\

Reply

kindly help with the coding for printing the following pattern
1 2 3 4 5 6 7 8 9
1 2 3 4 6 7 8 9
1 2 3 7 8 9
1 2 8 9
1 9
1 2 8 9
1 2 3 7 8 9
1 2 3 4 6 7 8 9
1 2 3 4 5 6 7 8 9

Reply

what will be the code for
1
11
21
1211
111221
312211
13112221
1113213211

Reply

55555
51115
52225
53335
54445
55555
Please code for this pattern

Reply

How to print
1 1 1 1 1
1 2 2 2 1
1 2 3 2 1
1 2 2 2 1
1 1 1 1 1

It is the output when input is 3
I need a dynamic output
I have been trying this since a week.

Reply

Help me with this code for
123456789
12346789
123789
1289
19

Reply

can anyone help me for this pattern
1
2*3
4*5*6

Reply

can u plz send me this even no program
2 4 6 8 10
2 4 6 8
2 4 6
2 4
2
2 4
2 4 6
2 4 6 8
2 4 6 8 10

Reply

sir i want to know how to crack the following code
15.
14.10
13.09.06
12.08.05.03
11.07.04.02.01

Reply



How to print this pattern 5*5
1 2
3 4
5
6 7
8 9

Reply

class Sample
{
public static void main ( String arg[] )
{
int k=0;
int l=k;
int n=k;
for(int i =1;i<=4;i++)
{

for(int j=1;j<=4;j++)
{
if (i==1 )
{
k=k+1;
if(k==4)
{
k=2;

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

}
else if(i ==3)
{
l=l+1;
if(l==4)
{
l=2;

}
System.out.print(l+" ");
}
else if((i==2 || i ==4) && (j==1))
{
System.out.print(2+" ");
}
else if(i==2)
{
n = n+1;
System.out.print(n+" ");
}
else
{
n = n+1;
System.out.print(n+" ");
}

}
n=0;
System.out.println();
}
}
}

Reply

class Sample
{
public static void main ( String arg[] )
{
int k=0;
int l=k;
int n=k;
for(int i =1;i<=4;i++)
{

for(int j=1;j<=4;j++)
{
if (i==1 )
{
k=k+1;
if(k==4)
{
k=2;

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

}
else if(i ==3)
{
l=l+1;
if(l==4)
{
l=2;

}
System.out.print(l+" ");
}
else if((i==2 || i ==4) && (j==1))
{
System.out.print(2+" ");
}
else if(i==2)
{
n = n+1;
System.out.print(n+" ");
}
else
{
n = n+1;
System.out.print(n+" ");
}

}
n=0;
System.out.println();
}
}
}

Reply

class Sample
{
public static void main ( String arg[] )
{
int k=0;
int l=k;
int n=k;
for(int i =1;i<=4;i++)
{

for(int j=1;j<=4;j++)
{
if (i==1 )
{
k=k+1;
if(k==4)
{
k=2;

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

}
else if(i ==3)
{
l=l+1;
if(l==4)
{
l=2;

}
System.out.print(l+" ");
}
else if((i==2 || i ==4) && (j==1))
{
System.out.print(2+" ");
}
else if(i==2)
{
n = n+1;
System.out.print(n+" ");
}
else
{
n = n+1;
System.out.print(n+" ");
}

}
n=0;
System.out.println();
}
}
}

Reply

Public class Piyush{
public static void main(String args[]){
For(int I=1;I<=5;I++){
System.out.print(I);
For(int j=I;j>=1;j---){
System.out.print(j);
}
System.out.println();
}
}
}

Reply

public static void main(String args[])
{
int l = 1;
for(int i=1;i<=5;i++)
{
for(int z=1;z<=i;z++)
{
System.out.print(z);
}
if(i<5)
{
System.out.print(" ");
}
for(int x =l;x>=1;x--)
{
System.out.print(x);
}
l++;
System.out.println();
}
}
}

Reply

public static void main(String args[])
{
int l = 1;
for(int i=1;i<=5;i++)
{
for(int z=1;z<=i;z++)
{
System.out.print(z);
}
if(i<5)
{
System.out.print(" ");
}
for(int x =l;x>=1;x--)
{
System.out.print(x);
}
l++;
System.out.println();
}
}
}

Reply

public static void main(String args[])
{
int l = 1;
for(int i=1;i<=5;i++)
{
for(int z=1;z<=i;z++)
{
System.out.print(z);
}
if(i<5)
{
System.out.print(" ");
}
for(int x =l;x>=1;x--)
{
System.out.print(x);
}
l++;
System.out.println();
}
}
}

Reply
«Oldest   ‹Older   1001 – 1200 of 1225   Newer›   Newest»

Make sure you tick the "Notify Me" box below the comment form to be notified of follow up comments and replies.