473,394 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Another "while loop problem": anyone, help me please? :-)

aprilmae36
Nice day to all... Here I am again, having another problem with loops... lol... Can you please help me make a while loop program that the output will be like this:

1
121
12321
1234321
123454321

:-)

Thank you so much....
Nov 12 '06 #1
1 1241
r035198x
13,262 8TB
Nice day to all... Here I am again, having another problem with loops... lol... Can you please help me make a while loop program that the output will be like this:

1
121
12321
1234321
123454321

:-)

Thank you so much....
Probably half a dozen ways of doing this
Expand|Select|Wrap|Line Numbers
  1.  
  2. class aprilmae36 {
  3.      public static void main(String[] args) {
  4.    int n = 4;
  5.    int i = 1;
  6.    int row = 0;
  7.    boolean up = true;
  8.          while(i < 6) {
  9.     for(int k = 0; k < n;k++) {
  10.      System.out.print(" ");
  11.     }
  12.           for(int l = 1; l < i; l++) {
  13.      System.out.print(""+l);
  14.     }
  15.     for(int l = i; l > 0; l--) {
  16.        System.out.print(""+l);
  17.     }
  18.     i++;
  19.     n--;
  20.     System.out.println();
  21.    }
  22.  }
  23. }
  24.  
  25.  
Nov 12 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: OllimaX | last post by:
Hi all you fine people! I tried to view older messages, but couldn't find a match with my present problem. Please see an example of the original xml. As you can see, the order of elements is...
13
by: Paul T. RONG | last post by:
Hello there, This is the case: the mde I made works alright on my machine, but there is a small problem when I installed it on a user's machine (His machine's OS is Windows XP Pro and it has...
0
by: maxim mat | last post by:
Hi I need to build client for web service. But when I'm using Visual Studio .NET to add Web Reference, I get error: "Custom tool error: Unable to import WebService/Schema. Unable to import...
0
by: Guilherme Silva | last post by:
Hi All, I found another problem with .NET about "fail to start monitoring". This one is different from any other because it only show this error without "Access Denied". Even the Excpetion...
1
by: funfair | last post by:
HI,EVERY ONE first problem, i have create a database in access 2003 it worked fine untill i have format my laptop . now im working on office 2003 on windows xp and i have norton 2006 but im...
2
by: vinit_mahajan99 | last post by:
Hello All. I am designing the master page for my site. I have used a table and ther are three rows in a table. Table lies in the 1. Header 2.ContentHolder 3.Footer
0
by: sa6113 | last post by:
I want to connect to a Windows machine in my network , using ssh, I use paramiko but I have problem in authentication, would you please help me? 1- I have installed freeSSHD in server machine? Is...
9
viswammamilla
by: viswammamilla | last post by:
Hai to everyone.I need a help I have an application,in this user want to type his IP address.I want MaskedtextBox for IP address format like 192.168.0.10 like this,in my toolbox i didnt have...
3
by: uma9 | last post by:
hi, the code below is used to insert a single record....i want to know how to insert multiple records using a "for" loop...please help Set connect = CreateObject ("ADODB.Connection")...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.