0% found this document useful (0 votes)
3 views6 pages

Understanding Algorithms and Data Types

An algorithm is a sequence of instructions designed to solve a problem, characterized by its finiteness and ability to be represented in pseudocode. The pseudocode consists of a header, a declarative part listing variables and constants, and a body containing executable tasks. Data types in algorithms include constants and variables, with specific syntax for each, and can be categorized into digital, alphanumeric, and boolean types.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Understanding Algorithms and Data Types

An algorithm is a sequence of instructions designed to solve a problem, characterized by its finiteness and ability to be represented in pseudocode. The pseudocode consists of a header, a declarative part listing variables and constants, and a body containing executable tasks. Data types in algorithms include constants and variables, with specific syntax for each, and can be categorized into digital, alphanumeric, and boolean types.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Definition:

An algorithm is a sequence of actions or instructions that must be executed in


a well-defined order to solve a problem (or carry out a task).

a. Characteristics of an algorithm:
▪ The realization of an algorithm is a creative act based on logic.

▪ An algorithm must be finite and must terminate after a finite number of operations.

▪ The same problem can be solved using several [Link])

Teacher AMINE Abdelmoujoud 1


An algorithm can be represented using pseudocode or aorganizational chart.
An algorithm written in pseudo-code consists of the following three parts:
The header, the declarative part, and the body
pseudo-code
The header
The declarative part
Start
Instructions The body: the tasks to be executed.
End

Teacher AMINE Abdelmoujoud 2


1. The header of an algorithm: Consists of the word Algorithm, followed by a name.
identifying the algorithm.
Example: SumAlgorithm;
InvoiceAlgorithm
2. The declarative part of an algorithm: includes a list of variables and
constants used and manipulated in the body of the algorithm.

Teacher AMINE Abdelmoujoud 3


✓Definition:
Data are information necessary for the execution of an algorithm. We
distinguishes two categories: constants and variables.
1. the constants:
A constant is a fixed value that does not change during the execution of an algorithm.
A constant is characterized by its name and its value (fixed).
Syntax:
ConstantName _Constant = value;
Example:
ConstantePi=3,14 ;
ConstantB = 6;
ConstanteMois= 'Mars
Teacher AMINE Abdelmoujoud 4
2. the variables
A variable is an object whose content can be modified by a
action during the execution of an algorithm.
Une variable est caractérisée par son nom, sa valeur et son type.
Syntax: VariableName_Variable :Type;

Example:
Variable students: integer;
Variable note: real;
VariablePrénom :chaines de caractères;
VariableA :booléen;
VariableOperator:character;

Teacher AMINE Abdelmoujoud 5


3. The types of data

Digital Alphanumeric
Type of
Boolean
data Integer Real Chain of
Characters
(without the comma) (With and without the comma) characters
-345 -123,56 4,1×1038 'A,' '@' Ibn Sina
True
Examples 182 56.12 18 2 '? ‘ ‘49', '3872'
Hello Fake
2018 3 -123 '+' '$'

Note:
✓ '32' is different from 32 because '32' represents the number thirty-two while '32' represents the sequence of the digits 3 and 2.
✓ A numeric type variable cannot receive a string or boolean.

Teacher AMINE Abdelmoujoud 6

You might also like