algorithm is a prescribed set of well defined rules or instructions for the solution of the problem....

12
Algorithms and programming

Upload: elwin-dorsey

Post on 31-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used

Algorithms and programming

Page 2: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used

Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem.

Algorithmic language is a language or notation used to express clearly an algorithm.

Algorithm

Page 3: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used

1) Linear - Линейный

2) Branching - Разветвляющийся

3) Loop (Cycle) - Циклический

Types of algorithm

Page 4: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used

High level language – A variety of programming language in which the control and data structures reflect the requirements of the problem. It is translated in to machine code by compiler.(Pascal, Delphi, C, C++, etc)

Low level language – A variety of programming language in which the control and data structures directly reflect the underlying machine architecture(Assembler, CIL, etc)

Key words

Page 5: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used

Flowchart

Begin

Data input

Data output

End

Operations

Page 6: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used

1. Pour milk in the cup2. Put the cup on the stove3. Light the match 4. Bring the burning match to the stove5. Switch on the stove 6. Wait, until milk boils 7. Switch off the stove

Algorithm of boiling milk

Page 7: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used

1. Pour milk in the cup2. Switch on the stove 3. Light the match 4. Bring the burning match to the stove5. Put the cup on the stove6. Wait, until milk boils 7. Switch off the stove

Algorithm of boiling milkYou must follow the correct sequence of the algorithm

Page 8: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used

Program HW; begin writeln (‘Pour milk in the cup’); // shows on the

screen writeln (‘Put the cup on the stove’); writeln (‘Light the match’); writeln (‘Bring the burning match to the

stove’); writeln (‘Switch on the stove’); writeln (‘Wait, until milk boils’); writeln (‘Switch off the stove’); End.

Attempt these codes in Pascal

Page 9: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used

Program HW;beginwriteln (‘Hello world’); // shows on the screenEnd.

print "Hello, world!“

#include <stdio.h> int main(void) {

printf("Hello, world\n"); //shows on the screen

return 0; }

<?php echo "Hello, world!";

?>

“Hello world” in different programming languages

Page 10: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used

Hello World message in VBA for Excel

Page 11: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used

Create simple program, which can display your age in months, weeks, days, hours, minutes, seconds.

Page 12: Algorithm is a prescribed set of well defined rules or instructions for the solution of the problem. Algorithmic language is a language or notation used