Loop exercises

Try the following exercises, individually or in pairs.

Number sequences

This program will generate a sequence of numbers by asking for a limit, and then printing 1, then that plus two, that plus 3, that plus 4, etc.

Enter limit: 50
1
2
4
7
11
16
22
29
37
46

Shape

This program will ask for a size, and then print the following shape.

Enter height: 8
       o
      o.o
     o...o
    o.....o
   o.......o
  o.........o
 o...........o
ooooooooooooooo