The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
fred rosenberger wrote:What have you tried?
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
"If the facts don't fit the theory, get new facts" --Albert Einstein
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Hunter McMillen wrote:dont think of it as trying to print a triangle, think of it as trying to print out a rectangle partially filled with spaces.
Now look at the number of spaces (marked by '-' ) versus the number of stars on each line. There is a pattern.
Hunter
EDIT: fixed typo
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
naved momin wrote:but i need to implement this only with the help of " for " loop , no other loops or control structures.
then how to do this , the above programe is typing the stars from right to left
but in this we need to put a 4 empty space in 0 line and then we have to reduce the space , how to achieve this with for loops.
Hunter McMillen wrote:dont think of it as trying to print a triangle, think of it as trying to print out a rectangle partially filled with spaces.
Now look at the number of spaces (marked by '-' ) versus the number of stars on each line. There is a pattern.
Hunter
EDIT: fixed typo
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
naved momin wrote:
i have made it ,. tricky , but still succeded just with the help of for loop
Raymond Tong wrote:
naved momin wrote:
i have made it ,. tricky , but still succeded just with the help of for loop
Try to remove all the for statements and leave only the print and println statements.
There is a way to make use of for loop to print space x times and print star y times where x + y = 4.
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
naved momin wrote:i didnt get you actually
as you had said , i have tried , will you throw some solution to this .
it is just printing a star one below the other.
You mean "Terminate[s] the current line by writing the line separator string".Raymond Tong wrote: ... step 4. print "line break and/or carriage return"
Consider Paul's rocket mass heater. |