![]() |
| |||||||
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Senior Member Join Date: Oct 2008
Posts: 115
Reputation: 6 ![]() cBay Rating: | Hey, I am doing basic java and we are doing some pyramids and I am really struggling. I really want to learn java, so if anyone would be nice enough to help me out please let me know. I would think it would be easier to do it over aim rather then do it over the thread, but basically i have to make 4 pyramids * ** *** **** ***** ***** **** *** ** * -----------------* ---------------*-- * -------------* --* --* -----------* --* --* --* ---------*-- *-- *-- *-- * edit: **** the above one took out the spaces so im gunna replace the spaces wit - and the above one flipped. I got the first 2, but i can't get the second 2. Also, they have to rely on the input, so for the above pyramids the input was 5. The input is between 1-20. Any help is greatly appreciated edit: will be posting code i have atm shortly Code: package loops;
import java.io.*;
public class Main {
public static void main(String[] args) {
int userinput = 0;
do
{
System.out.println("enter number less than 18");
userinput = Cherokee.readInt();
}while(userinput>= 18 && userinput<1);
for(int x = 0;x<=userinput;)
{
for (int y = 0;y<x;y++)
System.out.print("*");
System.out.println("");
x++;
}
System.out.println(" ");
for(int x = 0;x<userinput;)
{
for (int y = 0;y<userinput;)
{
if(x>y)
System.out.print(" ");
else
System.out.print("*");
y++;
}
System.out.println("");
x++;
}
System.out.println(" ");
}
}
__________________ PM me for free cam credits |
| | |
| Sponsored Links | |
![]() |
| Tags |
| java |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java | Todd0012 | Computers | 5 | 10-03-2009 07:08 AM |
| Does anyone do Java? | Ryutso | General | 11 | 08-16-2009 01:39 PM |
| Need Help with Java Bot | kelvinator44 | Bot Makers | 0 | 06-09-2009 10:58 AM |
| Java or c++? | zero | Chit Chat | 10 | 10-26-2008 07:02 PM |