PDA

View Full Version : Java noob needs help with a java coding problem.


_DrMario_
08-31-2006, 01:12 AM
Hi, I need to do a program where the user needs to imput a number of lines between 1 and 8 and then the program will make a pyramid of some kind out of a number that is 2^x (1-2-4-8-16 etc). I can calculate and have the numbers but I have no freaking idea how to put them like in the following exemple in the image.

ex :

Number of lines = 4. There's supposed to be 4 space between each column.

http://img.photobucket.com/albums/v192/Masterzeus/sdfsdfsdf-1.jpg

I have to do it with "for" loops. Anyone have any idea?

Thanks.

Gox
08-31-2006, 03:54 AM
Do you have any code written, that you can show? I'd rather fix your code, than give you mine.

Mess around with a for loop printing the numbers out and you should be able to massage the code to fit your application fairly easily. You might want to declare a variable that acts like a spacer that's a String of 4 spaces to help with your formatting.

_Aerospace_Eng_
08-31-2006, 04:00 AM
_DrMario_ you should probably read this thread http://www.codingforums.com/showthread.php?t=53446
basically it says we aren't here to do your homework assignments for you.