- #1
Hiche
- 84
- 0
..so, we have been assigned a homework to print a certain ASCII art using only loops and methods. We can also use the built-in math methods such as the exponential one and whatnot.
Basically, we have been asked to print an increasing loop that goes as follows:
..and so on, so forth. Notice how the stars increase by 2 then by 4, then by 2 then by 4. The sequence in which the stars are increasing within is 2,4,2,4,2,4,2,4...I managed to find the series for that: 3 + (-1)^n or 2 + 2 * (n % 2) where n >= 1.
Is there a way to use that in a loop? I'm slightly bewildered at the moment as this problem overwhelms my basic understanding on loops.
Basically, we have been asked to print an increasing loop that goes as follows:
Code:
*
***
*******
*********
*************
Is there a way to use that in a loop? I'm slightly bewildered at the moment as this problem overwhelms my basic understanding on loops.