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

From Free Pascal wiki
Jump to navigationJump to search
(New page: 2F - Programming Assignment Again find the sum and average of five numbers, but this time read in five integers and display the output in neat columns. Refer to the original problem spec...)
 
m (bypass language bar/categorization template redirect [cf. discussion])
 
(10 intermediate revisions by 7 users not shown)
Line 1: Line 1:
2F - Programming Assignment
+
{{Basic Pascal Tutorial/Chapter 2/Programming Assignment}}
 +
{{TYNavigator|Chapter 2/EOLN and EOF|Chapter 2/Solution}}
 +
 
 +
2F - Programming Assignment (author: Tao Yue, state: unchanged)
  
 
Again find the sum and average of five numbers, but this time read in five integers and display the output in neat columns.
 
Again find the sum and average of five numbers, but this time read in five integers and display the output in neat columns.
Line 19: Line 22:
 
As an added exercise, you can try to write the output to a file. However, I won't use files in the problem solution.
 
As an added exercise, you can try to write the output to a file. However, I won't use files in the problem solution.
  
{|style=color-backgroud="white" cellspacing="20"
+
{{TYNavigator|Chapter 2/EOLN and EOF|Chapter 2/Solution}}
|[[EOLN_and_EOF|previous]] 
 
|[[op_contents|contents]]
 
|[[Solution_2|next]]
 
|}
 

Latest revision as of 16:18, 20 August 2022

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

 ◄   ▲   ► 

2F - Programming Assignment (author: Tao Yue, state: unchanged)

Again find the sum and average of five numbers, but this time read in five integers and display the output in neat columns.

Refer to the original problem specification if needed. You should type in the numbers separated by spaces from the keyboard: 45 7 68 2 34.

The output should now look like this:

Number of integers = 5

Number1:      45
Number2:       7
Number3:      68
Number4:       2
Number5:      34
================
Sum:         156
Average:      31.2

As an added exercise, you can try to write the output to a file. However, I won't use files in the problem solution.

 ◄   ▲   ►