Numbers in Loops

Loops can be used to produce number sequences.

Write three for.. loops to produce these sequences:

     2 , 4 , 6 , 8 , 10

     9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 , Blast Off

     1.0 , 1.1 , 1.2 , 1.3 , 1.4 , 1.5 , 1.6 , 1.7 , 1.8 , 1.9 , 2.0

Solution

    for(int  x = 2x  <=  10x = x + 2 )
   {
        output(x);
   }

   for(int  x = 9x >= 0x = x - 1 )
   {
        output(x);
   }
    output("Blast Off");              // don't put this inside the loop

   for(int  x = 0 ;  x <= 10 ;  x = x + 1 )
   {                                         //** counting by 0.1 produces errors **
        output( 1 + x / 10.0 );
   }