Loops Problem Set

Even Numbers

Print out all even numbers between 1 and 50.  Write two solutions: one with a while loop and one with a for loop.

ASCII Art

Write code to create an ASCII art triangle like the one pictured.  Use for loops.

$
$$
$$$
$$$$
$$$$$
$$$$$$

HINT: you may want to use nested loops

Fizzbuzz

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz

Printer Friendly - Loops Problem Set

By Colt Steele

Printer Friendly - Loops Problem Set

  • 1,901