What have you tried? Post your code that shows the problem.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
What have you tried? Post your code that shows the problem.
hey sir Norms,
the codes you post on post #12 it will shows an output like my 2nd output right?
Compile and execute it and see what is printed.
Sir, every false statement will move to the >>>} System.out blah blah right?
There is no boolean variable involved in this logic. It is only loops and math.
arghhhh.... can't help myself...
Ok. Thats a start. You've printed the first line with some spaces and some *s
Now add code to print out the next lines.
You need a loop for the spaces and a loop for the *s
Can you explain why you start with x=5 in the first for loop?
It would help if you used variable names and added comments to the code like I did in post#12
i gave a value of 5 to x so if then it goes back to that statement with an increment it will goes false and print an *s because the value of n is no longer equalled or greater than the value of x.
but i know that's wrong also. because if it goes to System.out.print("*"); it will goes back to the first statement and will tell that every statement is false. And then it will always print *** infintely or what
Last edited by javarum; June 27th, 2011 at 04:12 PM.
Now add code to print out the next lines: 2 to 5.
You need a loop for the spaces and a loop for the *s
can i do this?
}
System.out.print("*");
System.out.println();
}
Try it and see what happens.
What is it you want those two statements to do?
Can they be merged into a single statement?
ehehe. just want to make a new line after printing the last * but it is wrong too. hayyayayay. im near to surrender
Sir back to my question cause i didnt understand what youve answered for that. ehehe!
Is every false statement goes after } ?
There are no true or false statements in this problem. It is done with loops and math.
im about to give up... geesh. i know this is too easy but im to newbie for this... not enough time. need to pass this later. ouch. =( and i dont have sleep yet.
Try a very simple exercise:
Write a loop to print x number of "*" on a line.
If x is 0 you print none,
if x is 1 you print 1
if x is 2 you print 2
etc
cant understand that. pitty on me
Your code shown in the first post does it.
I guess you should give up for now and try later.
cant i have the answer from you? not far from what is my script before? i promise to be better next week. i just need to pass this later on. =(
i just need the script for this outputs
* ** *** **** ***** and this one ***** **** *** ** *
Last edited by javarum; June 27th, 2011 at 05:35 PM. Reason: for tagging
Come on back when you have had time to write the code.
See post#42 It has as simple a suggestion as I can make.
By the way, SIR Thanks so much your time.
You're welcome.
Get a good sleep and try again tomorrow.
javarum (June 27th, 2011)
there's no tomorrow. hehe! ill fail this assignment. hehe! but ill be better for the next homework. geesh. Thanks Sir! Night!
Hi Sir! Can't sleep... already got headache... im about to sleep when i suddenly thought of this.
am i on my way nearer or further?