Difference between revisions of "Basic Pascal Tutorial/Chapter 3/Programming Assignment"

From Lazarus wiki
Jump to navigationJump to search
m
m (Kai 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...)
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
{{Programming Assignment 3}}
 
{{Programming Assignment 3}}
 +
{{TYNavigator|FOR..IN|Solution_3}}
  
 
3E - Programming Assignments (author: Tao Yue, state: unchanged)
 
3E - Programming Assignments (author: Tao Yue, state: unchanged)
Line 19: Line 20:
 
  1024, 2048, 4096, 8192, 16384
 
  1024, 2048, 4096, 8192, 16384
  
{|style=color-backgroud="white" cellspacing="20"
+
{{TYNavigator|FOR..IN|Solution_3}}
|[[FOR..IN|previous]] 
 
|[[Contents|contents]]
 
|[[Solution_3|next]]
 
|}
 
 
 
[[Category: Object Pascal Introduction]]
 

Revision as of 03:52, 3 February 2022

български (bg) English (en) français (fr) 日本語 (ja) 中文(中国大陆)‎ (zh_CN)

 ◄   ▲   ► 

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:

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

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