Loop exercises Download

Charlie Lunetta

strings, for loops, printing Student approved


Introduction

Complete each of these tasks to increase your comfort level and skill in writing loops. The tasks below tell you what the output of your loops should be—you have to figure out how to write them!


Task

Write loops that print:

  1. Even numbers between 22 and 48.
  2. Multiples of 5 less than or equal to 85.
  3. Powers of 2 from 0 to 10. (Don't forget that one way to think about powers is as repeated multiplication.)
  4. The numbers 1 to 20, then back down to 1.
  5. A Tic-Tac-Toe board, where each square is a 3x3 grid. Number each square, placing the value in the center of the grid.


Starter code

class Loops{
	static void evenNumbers(){

	}

	static void multiplesFive(){

	}

	static void powersOf2{

	}

	static void numberRange(){

	}

	static void ticTacToe(){

	}
}

Useful tools to solve the problem