Ok, I need help on a for loop nested program using for loops, I'm trying to use a patten that goes like this:
123456
12345
1234
123
12
1

but when I try it, it goes like this:
654321
65432
6543
654
65
6

This is my program:

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

     //set up for the rows

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

     for (int num = 6; num >= row; num--){

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

    }

 }

Can anybody help please? thanks

Ok I solved the last program, but I need on this one, I have no clue:

Ok, I need help on a for loop nested program using for loops, I'm trying to use a patten that goes like this:

123456
  12345
    1234
      123
        12
          1

but when I try it, it goes like this:

123456
12345
1234
123
12
1

This is my program:

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

     //set up for the rows

     for(int row = 7 ; row > 1; row--){

     for (int num = 1; num < row; num++){

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

}

     }

Can anybody help please? thanks

if you write the problem using code bbcode, it looks better...
you want something like

123456
 12345
  1234
   123
    12
     1

There are different ways to solve this problem.
I would used a for loop to count how many empty spaces (" ") I need to print before I put the number. So that would increase from 0 to 5.. This way, it actually needed three for loops, and one counter based on what it would count how many space is needed.
Code would look something like:

int counter=0;
firstLoop: for() {
  secondLoop:for() {
    thirdLoop:for(0->counter){
      System.out.print(" ");
    }
    System.out.print(num);
  }
  System.out.println();
  counter++;
}

this:

123456
12345
1234
123
12
1

This is my program:

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

     //set up for the rows

     for(int row = 6 ; row >= 1; row++){

     for (int num = 1; num <= row; num++){

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

}

 }

where u frm?????
my id:chrsmnsn@gmail.com

this:

123456
12345
1234
123
12
1

This is my program:

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

     //set up for the rows

     for(int row = 6 ; row >= 1; row++){

     for (int num = 1; num <= row; num++){

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

}

     }

where u frm?????
my id: (snip)

???? This post is years old, do u need help or you just wondering where I'm from?

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

can anyone solve this?
a b c d e d c b a
a b c d***d c b a
a b c*******c b a
a b***********b a
a***************a

NOTE: here '*' denotes space

hey megha SR
here is ur answer
class pattern
{
static void main()
{
int i,k,m,j,f,t;
for(i=0;i<4;i++)
{
m=4-i;
for(j=1,f=97;j<=m;j++,f++)
System.out.print((char)f);
for(t=1;t<=2*i;t++)
System.out.print(" ");
f=100-i;
for(k=m;k>0;k--,f--)
System.out.print((char)f);
System.out.println();
}
}
}

plz someone help me in java how cn i print pattern like this:
1******
12*****
123****
1234***
12345**
123456*
1234567

matrix like this in java:
0 1 1 1 1
-1 0 1 1 1
-1 -1 0 1 1
-1 -1 -1 0 1
-1 -1 -1 -1 0
0 in diagnal 1 in upper nd -1 in lower side...

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do not hijack old threads by posting a new question as a reply to an old one"
http://www.daniweb.com/community/rules
Please start your own new thread for your question

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.