File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java program" Watch "java program" New topic
Author

java program

sahan thinusha
Greenhorn

Joined: Nov 10, 2012
Posts: 10

please give me program for output as following * pattern using 2 for loops & only use one star?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

You need to read DoYourOwnHomework and NotACodeMill.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38511
    
  23
Welcome to the Ranch

As people have said, you will have to show what you have done so far. By the way, for code you should always use code tags. They work for what you posted, too; you can see the spaces appear in the right places now I have added the tags.
sahan thinusha
Greenhorn

Joined: Nov 10, 2012
Posts: 10


this program output is
******
******
******
******
******
******
now,how I change program to print output like this
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

If you read the links that Bear posted, and also the ShowSomeEffort(←click) link, you'll see that folks here aren't going to just hand you the answer. So take your best shot, and come back with specific questions if you get stuck.

Here's a very important tip though: Don't write a single line of code until you've written down very clear, precise, simple steps in English (or whatever your native language may be) describing how to do the process without regard to any programming language.
Len Padson
Ranch Hand

Joined: Nov 21, 2011
Posts: 40
Ask yourself questions like,

How does the number of the empty space and the number of the line its on correlate?

If you can find a correlation, then you could use an if statement to determine whether to print an asterisk or not.

That should get you started, but if you tinker with that for awhile (remember, ShowSomeEffort) and can't figure it out, let us know what you've done and we can help further.
 
 
subject: java program