Hi i am practicing nested loop here are the examples that i did, but i
was particularly stuck at this part of nested loop
i can do this example below
**
*
code:
c = 5
for r in 1…5
c.times {print "*"}
c -= 1
print "\n"
end
But how to achieve this result
*
**
i was confused on how to reverse the * on the 5th column
basically i wanted the * to start from the 5th column and decrease down
to 4th row and so on from the right-hand side.
Don’t give me a answer
i want a hint only
Thx alot
i was confused on how to reverse the * on the 5th column
basically i wanted the * to start from the 5th column and decrease down
to 4th row and so on from the right-hand side.
Don’t give me a answer
i want a hint only
Thx alot
Think of a line as comprised of " " and “*” in related quantities
i was confused on how to reverse the * on the 5th column
basically i wanted the * to start from the 5th column and decrease down
to 4th row and so on from the right-hand side.
Don’t give me a answer
i want a hint only
Thx alot
Think of a line as comprised of " " and “*” in related quantities
Yup i did that. I can’t think of any way to print the * from the
left-hand downstairs
Hi im solving these questions that i am facing right now
n = 1
for i in 1…8
for c in 1..n
case i
when 1
print "1"
when 2
print "1 2"
when 3
print "1 2 4"
when 4
print "1 2 4 8"
when 5
print "1 2 4 8 16"
when 6
print "1 2 4 8 16 32"
when 7
print "1 2 4 8 16 32 64"
when 8
print "1 2 4 8 16 32 64 128"
end
print "\n"
end
end
Even though it’s static. I tried my very best to be dynamic. Any kind
souls can guide me? Don’t give answer please. I want hint only. I tried
alot of ways to be dynamic, but i can only do static for this questions.