Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 3/Programming Assignment

Sent here from Programming Assignment 3.

English · Français · Български · 中文(中国) · 日本語

3E - Programming Assignments (author: Tao Yue, state: unchanged)

Problem 1

Find the first 10 numbers in the Fibonacci sequence. The Fibonacci sequence starts with two numbers:

text
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:

text
1 1 2 3 5 8 13 21 34 55 89 144 ...

Problem 2

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

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

From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 3/Programming Assignment", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 3, last changed by WikiArchive .

Edited on wiki.freepascal.org by 5 people, 2007–2022

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
KeesNew page: 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 b...
Kees
Kees
Kees
Jwdietrich
Swen (minor)
FTurtle
FTurtle
Kai BurghardtKai Burghardt moved page Programming Assignment 3 to Basic Pascal Tutorial/Chapter 3/Programming Assignment: tidy up main name space: create subpage hierarchy for basic Pascal tutorial [cf. [[Special: Pe... (minor)
Kai Burghardtbypass redirects [cf. discussion]
Kai Burghardtbypass language bar/categorization template redirect [cf. discussion] (minor)

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.