0% found this document useful (0 votes)
31 views34 pages

En Course Introduction

Uploaded by

louisalhi2005
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)
31 views34 pages

En Course Introduction

Uploaded by

louisalhi2005
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
You are on page 1/ 34

Introduction to Algorithmics

Mohamed MESSABIHI
[email protected]

University of Tlemcen
Department of Computer Science

https://sites.google.com/site/informatiquemessabihi/
What Does "Programming" Mean?

Programming means creating "computer programs". Programs instruct


the computer to perform actions.
• A calculator is a program.
• Your Microsoft Word is a program.
• Facebook is a program.
• Video games are programs.
• Spotify is a program
• ...
What Does "Programming" Mean?

Programming means creating "computer programs". Programs instruct


the computer to perform actions.

• A calculator is a program.
• Your Microsoft Word is a program.
• Facebook is a program.
• Video games are programs.
• Spotify is a program
• ...
What Does "Programming" Mean?

Programming means creating "computer programs". Programs instruct


the computer to perform actions.
• A calculator is a program.
• Your Microsoft Word is a program.
• Facebook is a program.
• Video games are programs.
• Spotify is a program
• ...
What Does "Programming" Mean?

Programming means creating "computer programs". Programs instruct


the computer to perform actions.
• A calculator is a program.
• Your Microsoft Word is a program.
• Facebook is a program.
• Video games are programs.
• Spotify is a program
• ...
What Does "Programming" Mean?

Programming means creating "computer programs". Programs instruct


the computer to perform actions.
• A calculator is a program.
• Your Microsoft Word is a program.
• Facebook is a program.
• Video games are programs.
• Spotify is a program
• ...
What Does "Programming" Mean?

Programming means creating "computer programs". Programs instruct


the computer to perform actions.
• A calculator is a program.
• Your Microsoft Word is a program.
• Facebook is a program.
• Video games are programs.
• Spotify is a program
• ...
"Programming", indeed! But which language
should we use?
• The computer only understands machine language. For example, the
instruction "Perform the calculation 4 + 7" is translated into
machine language as: 0010110110010011010011110

• This machine language is called binary language

• This binary language is incomprehensible.

• The computer does not speak English, French, or Arabic.

Problem
How can we communicate with the computer in a simpler way than in
binary?
"Programming", indeed! But which language
should we use?
• The computer only understands machine language. For example, the
instruction "Perform the calculation 4 + 7" is translated into
machine language as: 0010110110010011010011110

• This machine language is called binary language

• This binary language is incomprehensible.

• The computer does not speak English, French, or Arabic.

Problem
How can we communicate with the computer in a simpler way than in
binary?
"Programming", indeed! But which language
should we use?
• The computer only understands machine language. For example, the
instruction "Perform the calculation 4 + 7" is translated into
machine language as: 0010110110010011010011110

• This machine language is called binary language

• This binary language is incomprehensible.

• The computer does not speak English, French, or Arabic.

Problem
How can we communicate with the computer in a simpler way than in
binary?
"Programming", indeed! But which language
should we use?
• The computer only understands machine language. For example, the
instruction "Perform the calculation 4 + 7" is translated into
machine language as: 0010110110010011010011110

• This machine language is called binary language

• This binary language is incomprehensible.

• The computer does not speak English, French, or Arabic.

Problem
How can we communicate with the computer in a simpler way than in
binary?
"Programming", indeed! But which language
should we use?
• The computer only understands machine language. For example, the
instruction "Perform the calculation 4 + 7" is translated into
machine language as: 0010110110010011010011110

• This machine language is called binary language

• This binary language is incomprehensible.

• The computer does not speak English, French, or Arabic.

Problem
How can we communicate with the computer in a simpler way than in
binary?
Programming Languages

• Invent new languages that can be translated into binary for the
computer.

• The most challenging part is to create the program that performs


this "translation."

• Fortunately,this program has already been written by computer


scientists, so we won’t have to rewrite it.

• We will use it to write sentences like "Perform the calculation 3 +


5," which will be translated by the "translation" program into
something like "0010110110010011010011110."
Programming Languages

• Invent new languages that can be translated into binary for the
computer.

• The most challenging part is to create the program that performs


this "translation."

• Fortunately,this program has already been written by computer


scientists, so we won’t have to rewrite it.

• We will use it to write sentences like "Perform the calculation 3 +


5," which will be translated by the "translation" program into
something like "0010110110010011010011110."
Programming Languages

• Invent new languages that can be translated into binary for the
computer.

• The most challenging part is to create the program that performs


this "translation."

• Fortunately,this program has already been written by computer


scientists, so we won’t have to rewrite it.

• We will use it to write sentences like "Perform the calculation 3 +


5," which will be translated by the "translation" program into
something like "0010110110010011010011110."
Programming Languages

• Invent new languages that can be translated into binary for the
computer.

• The most challenging part is to create the program that performs


this "translation."

• Fortunately,this program has already been written by computer


scientists, so we won’t have to rewrite it.

• We will use it to write sentences like "Perform the calculation 3 +


5," which will be translated by the "translation" program into
something like "0010110110010011010011110."
Programming Languages
• Invent new languages that can be translated into binary for the
computer.
• The most challenging part is to create the program that performs
this "translation."
• Fortunately,this program has already been written by computer
scientists, so we won’t have to rewrite it.
• We will use it to write sentences like "Perform the calculation 3 +
5," which will be translated by the "translation" program into
something like "0010110110010011010011110."
Why Program in C?

• There are many programming languages like C, C++, Java, Visual


Basic, Python, etc.

• C is a very popular language.

• It provides a solid foundation in programming and computer


architecture.

• It equips you with skills to learn any other programming languages


easily.

• It’s used for developing various software applications.

• Often taught in computer science studies.


Why Program in C?

• There are many programming languages like C, C++, Java, Visual


Basic, Python, etc.

• C is a very popular language.

• It provides a solid foundation in programming and computer


architecture.

• It equips you with skills to learn any other programming languages


easily.

• It’s used for developing various software applications.

• Often taught in computer science studies.


Why Program in C?

• There are many programming languages like C, C++, Java, Visual


Basic, Python, etc.

• C is a very popular language.

• It provides a solid foundation in programming and computer


architecture.

• It equips you with skills to learn any other programming languages


easily.

• It’s used for developing various software applications.

• Often taught in computer science studies.


Why Program in C?

• There are many programming languages like C, C++, Java, Visual


Basic, Python, etc.

• C is a very popular language.

• It provides a solid foundation in programming and computer


architecture.

• It equips you with skills to learn any other programming languages


easily.

• It’s used for developing various software applications.

• Often taught in computer science studies.


Why Program in C?

• There are many programming languages like C, C++, Java, Visual


Basic, Python, etc.

• C is a very popular language.

• It provides a solid foundation in programming and computer


architecture.

• It equips you with skills to learn any other programming languages


easily.

• It’s used for developing various software applications.

• Often taught in computer science studies.


Why Program in C?

• There are many programming languages like C, C++, Java, Visual


Basic, Python, etc.

• C is a very popular language.

• It provides a solid foundation in programming and computer


architecture.

• It equips you with skills to learn any other programming languages


easily.

• It’s used for developing various software applications.

• Often taught in computer science studies.


Is Programming difficult?

• Do you need to be a genius to start programming? NO

• Do you need to be an eminent mathematician to start


programming? NO

• You just need to understand how computers work.

• However, programmers need qualities like:


• Patience: A program never works perfectly on the first try; you need
to persistent!
• Logical thinking: while you don’t have to be a math expert, but
you’ll still need to think logically.
• Calmness: No, hitting your computer with a hammer won’t make
your program work.
Is Programming difficult?

• Do you need to be a genius to start programming? NO

• Do you need to be an eminent mathematician to start


programming? NO

• You just need to understand how computers work.

• However, programmers need qualities like:


• Patience: A program never works perfectly on the first try; you need
to persistent!
• Logical thinking: while you don’t have to be a math expert, but
you’ll still need to think logically.
• Calmness: No, hitting your computer with a hammer won’t make
your program work.
Is Programming difficult?

• Do you need to be a genius to start programming? NO

• Do you need to be an eminent mathematician to start


programming? NO

• You just need to understand how computers work.

• However, programmers need qualities like:


• Patience: A program never works perfectly on the first try; you need
to persistent!
• Logical thinking: while you don’t have to be a math expert, but
you’ll still need to think logically.
• Calmness: No, hitting your computer with a hammer won’t make
your program work.
Is Programming difficult?

• Do you need to be a genius to start programming? NO

• Do you need to be an eminent mathematician to start


programming? NO

• You just need to understand how computers work.

• However, programmers need qualities like:


• Patience: A program never works perfectly on the first try; you need
to persistent!
• Logical thinking: while you don’t have to be a math expert, but
you’ll still need to think logically.
• Calmness: No, hitting your computer with a hammer won’t make
your program work.
Is Programming difficult?

• Do you need to be a genius to start programming? NO

• Do you need to be an eminent mathematician to start


programming? NO

• You just need to understand how computers work.

• However, programmers need qualities like:


• Patience: A program never works perfectly on the first try; you need
to persistent!
• Logical thinking: while you don’t have to be a math expert, but
you’ll still need to think logically.
• Calmness: No, hitting your computer with a hammer won’t make
your program work.
Is Programming difficult?

• Do you need to be a genius to start programming? NO

• Do you need to be an eminent mathematician to start


programming? NO

• You just need to understand how computers work.

• However, programmers need qualities like:


• Patience: A program never works perfectly on the first try; you need
to persistent!
• Logical thinking: while you don’t have to be a math expert, but
you’ll still need to think logically.
• Calmness: No, hitting your computer with a hammer won’t make
your program work.
What Do You Need for C Programming?
• Programmers need three tools: a text editor, a compiler, and a
debugger.

• You can install these tools separately or use an Integrated


Development Environment (IDE).

• IDEs like Code::Blocks, Visual C++, Pycharm and Xcode simplify


the development process.
What Do You Need for C Programming?
• Programmers need three tools: a text editor, a compiler, and a
debugger.

• You can install these tools separately or use an Integrated


Development Environment (IDE).

• IDEs like Code::Blocks, Visual C++, Pycharm and Xcode simplify


the development process.
What Do You Need for C Programming?
• Programmers need three tools: a text editor, a compiler, and a
debugger.

• You can install these tools separately or use an Integrated


Development Environment (IDE).

• IDEs like Code::Blocks, Visual C++, Pycharm and Xcode simplify


the development process.
My First C Program

Example C Program
# include < stdio .h >

int main () {
printf ( " Hello , World !\ n " ) ;
return 0;
}

• when you run this program, it will display "Hello, World!" on the
screen and then terminate with a success status of 0.
• This simple program is often used as a starting point for learning
new programming languages, as it provides a basic understanding of
how to output text to the console.
Comments in C

Example:
/* Below are preprocessor directives . These lines add files
to the project ,
files called libraries . Thanks to these libraries , we have
pre - made functions to display messages on the screen . */

# include < stdio .h >


# include < stdlib .h >

/* Below , you have the main function of the program , called


main . All programs start with this function . Here , my
function simply displays " Hello " on the screen . */

int main ()
{
printf ( " Hello " ) ; // This instruction displays " Hello " on
the screen
return 0; // The program returns the number 0 and stops
}

You might also like