..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.(adsbygoogle = window.adsbygoogle || []).push({});

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.Code (Text):*

***

*******

*********

*************

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.

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: Loop predicament in Java

**Physics Forums | Science Articles, Homework Help, Discussion**