Print Powers of Two

From CompSciWiki
Revision as of 09:47, 6 April 2010 by LesE (Talk | contribs)

Jump to: navigation, search

Back to the Program-A-Day homepage

Problem

Remember that a while loop will execute infinitely until a specified condition is met. A for loop is similar except that the number of iterations is specified as an argument for the loop. Using both for and while loops, create a program that prints the powers of 2 from <math>2^0</math> <math>2^9</math>.

 

SideSectionTitle

float
Taken from http://www.flickr.com/photos/daniello/565304023/

An image or By Students section

Solution

The solution...

Code

SolutionCode goes here. Please DO NOT put your code in <pre> tags!

Back to the Program-A-Day homepage