Pieter J. Berkel's Web Site
Home > Teaching & Courses > Learn Pascal
Home Page
Photo Gallery
Travel Journal
My Teaching
 - Applied Internet Tech
 - Learn Pascal
My Resume
Contact Details
Learn Pascal
3E - Programming Assignments

Problem 1
Find the first 10 numbers in the Fibonacci sequence. The Fibonacci sequence starts with two numbers:
     1 1
Each subsequent number is formed by adding the two numbers before it. 1+1=2, 1+2=3, 2+3=5, etc. This forms the following sequence:
     1 1 2 3 5 8 13 21 34 55


Problem 2
Display all powers of 2 that are <= 20000. Display the list in a properly formatted manner, with commas between the numbers. Display five numbers per line. The output should look like:

     1, 2, 4, 8, 16,
     32, 64, 128, 256, 512,
     1024, 2048, 4096, 8192, 16384



Previous lesson

To solution

Contents

Index

E-mail me

Copyright © 2002-2012 Pieter J. Berkel. All rights reserved.