Write a program that generates a pyramid of numbers from a users input (kbReader = new Scanner(System.in)) for example the number 5 is inputted and the wats printed is...

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

help?

sorry i had to erase the solution so that you have enough space to think

u should analyse the shape whatever it is then write the algorithm

So why did you do the lazy homework kiddo's homework for it?
To show how stupid you are by falling for the oldest trick in the book?
Or a misguided attempt to impress that kid with your brilliance in solving its problems for it?

you have a point

so im not going to get help?

you're not going to get your homework done for you, no.
If you have problems with specific parts of it, show what you've done and what is not working, and we can help you with hints on how to fix that.

For starters notice that the input will determine the number of lines. So use the input as upper limit to a for loop.
Then each line has that many number as the number of line.
First line: 1 number
Second line: 2 numbers
....

This will tell you the upper limit, which will be dynamic, of the inner loop

this is what i have so far
and
it doesnt print the pyramid continually if u know wat i mean each line starts with 1 and it has to keep going .. hints?

import java.io.*;
import java.util.*;

public class pyramid
{
public static void main (String args[])
{
int i;
int j;
System.out.println("Enter a number.");
     Scanner kb1Reader = new Scanner (System.in);
     int number = kb1Reader.nextInt();
     
     for(i=1;i<=number;i++)
 {
     
     System.out.println(i);
     for(j=1;j<=i;j++)
     {
         System.out.print(j);
        
    }
}

}
}

Try this:

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

The inner loop will do the printing, and the outer loop will only change lines:

Now instead of printing the 'j', declare another int variable outside the loops. Print that, and each time you print it, increase its value.

so i need help, i need a java program that does this

a.

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

b.

**********
--*********
----********
------*******
--------******
----------*****
------------****
--------------***
----------------**
------------------*
The ---- are spaces
I have a. done but i cant get b. down, can anybody help?

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

no one is gonna do your homework for you
lazy L

I have a. done but i cant get b. down, can anybody help?

Start a new thread. Don't hijack someone else's. Do you want us to stop helping the OP just for you?

Start a new thread and post some code. There are examples in this thread that can help you. If you could do the a) part then what is the problem with b) ? Since you have code for a) make changes and post the new code.

help me please
JAVA PYRAMIDE using stack and queue

output
[1]Stack [2]Queue
how many input: 5

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

..,help me please

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.