Algorithms and
Programming
Easier than you thought…
 First you have to find a solution to a
problem
 Example: Find the sum of two numbers
 Formulate a solution in your own words
Your answer may look like this:
 Take two numbers
 Add them
 Display the answer
(this is your solution in words)
Algorithm
in words in pseudocode
 Take two numbers
 Add them
 Display the answer
Enter num1
Enter num2
Sum  num1 + num2
Write sum
Programming (Turbo Pascal)
 Enter num1
 Enter num2
 Sum  num1 + num2
 Write sum
Writeln(‘Please enter a
number.’);
Readln(num1);
Writeln(‘Please enter another
number.’);
Readln(num2);
Sum := num1 + num2 ;
Writeln(‘The sum of ’ ,num1, ‘and
’ , num2, ‘is ’ ,sum, ‘.’)
In Turbo Pascal, your program should look like this:
Program sum1;
uses crt;
var
num1, num2, sum: integer;
begin
clrscr;
writeln(‘Please enter a number.’);
readln(num1);
writeln(‘Please enter another number.’);
readln(num2);
sum:= num1 + num2;
writeln(‘The sum of ‘ ,num1, ‘ and ‘ , num2, ‘ is ‘ ,sum, ‘.’) ;
readln
end.
Quite easily done!
THE END
omaartens@nied.edu.na

More Related Content

PDF
PPTX
Ninth session
DOCX
Practical no 4
PDF
c++ exp 1 Suraj...pdf
DOCX
Practical no 1
PDF
New Orleans Saints and Academy Sports + Outdoors announce renewal of long-ter...
PPT
Russia turismo
PPTX
Jessica May - Occupational identity
Ninth session
Practical no 4
c++ exp 1 Suraj...pdf
Practical no 1
New Orleans Saints and Academy Sports + Outdoors announce renewal of long-ter...
Russia turismo
Jessica May - Occupational identity

Viewers also liked (14)

PPTX
The Conversation and the Future of Journalism
PDF
Coletneadeatividades5ano
PDF
2013 N. 04 - CIRCOLARE
PPTX
Bai 2
ODP
Show and tell javi 5c si blog
PPT
Cestitka za Uskrs !
PPTX
PDF
Sign trade-chennai
PPTX
PPTX
Fu tsquad builder_by_johns_angels
PPTX
How did you use media technologies in the
DOCX
Horror trailer evaluation
PDF
Regime dei Minimi 2015: riforma e novità
PPTX
The Conversation and the Future of Journalism
Coletneadeatividades5ano
2013 N. 04 - CIRCOLARE
Bai 2
Show and tell javi 5c si blog
Cestitka za Uskrs !
Sign trade-chennai
Fu tsquad builder_by_johns_angels
How did you use media technologies in the
Horror trailer evaluation
Regime dei Minimi 2015: riforma e novità
Ad

Similar to Algorithms and programs - an introduction (20)

PPTX
Algorithm and psuedocode
PDF
DATAND ALGORITHMSI (DSA010)_LESSON 1.pdf
PDF
C language algorithms
PDF
Pseudocode By ZAK
PDF
Unit 1-problem solving with algorithm
PPT
Data Structures- Part1 overview and review
PPTX
Problem Solving PPT Slides Grade 10- 11students
PPT
AOA Week 01.ppt
PPT
lec_4_data_structures_and_algorithm_analysis.ppt
PPT
lec_4_data_structures_and_algorithm_analysis.ppt
PPTX
Data Structure and Algorithms –Introduction.pptx
PPT
UNIT-2-PPTS-DAA.ppt
PPTX
UNIT-1.pptx python for engineering first year students
PPTX
Design and Analysis of Algorithm ppt for unit one
PDF
DAA Unit 1.pdf
PPTX
vingautosaved-230525024624-6a6fb3b2.pptx
PPTX
Algorithm Design and Problem Solving [Autosaved].pptx
PDF
Lecture 2 role of algorithms in computing
PDF
CP4151 Advanced data structures and algorithms
PDF
Programming paradigms c1
Algorithm and psuedocode
DATAND ALGORITHMSI (DSA010)_LESSON 1.pdf
C language algorithms
Pseudocode By ZAK
Unit 1-problem solving with algorithm
Data Structures- Part1 overview and review
Problem Solving PPT Slides Grade 10- 11students
AOA Week 01.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
Data Structure and Algorithms –Introduction.pptx
UNIT-2-PPTS-DAA.ppt
UNIT-1.pptx python for engineering first year students
Design and Analysis of Algorithm ppt for unit one
DAA Unit 1.pdf
vingautosaved-230525024624-6a6fb3b2.pptx
Algorithm Design and Problem Solving [Autosaved].pptx
Lecture 2 role of algorithms in computing
CP4151 Advanced data structures and algorithms
Programming paradigms c1
Ad

Recently uploaded (20)

PPTX
Share_Module_2_Power_conflict_and_negotiation.pptx
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Complications of Minimal Access-Surgery.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
Trump Administration's workforce development strategy
PDF
advance database management system book.pdf
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PDF
Empowerment Technology for Senior High School Guide
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
IGGE1 Understanding the Self1234567891011
PDF
HVAC Specification 2024 according to central public works department
PPTX
Computer Architecture Input Output Memory.pptx
PPTX
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Share_Module_2_Power_conflict_and_negotiation.pptx
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Complications of Minimal Access-Surgery.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
Trump Administration's workforce development strategy
advance database management system book.pdf
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
Empowerment Technology for Senior High School Guide
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
Practical Manual AGRO-233 Principles and Practices of Natural Farming
IGGE1 Understanding the Self1234567891011
HVAC Specification 2024 according to central public works department
Computer Architecture Input Output Memory.pptx
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
Uderstanding digital marketing and marketing stratergie for engaging the digi...
Cambridge-Practice-Tests-for-IELTS-12.docx
Chinmaya Tiranga Azadi Quiz (Class 7-8 )

Algorithms and programs - an introduction

  • 2.  First you have to find a solution to a problem  Example: Find the sum of two numbers  Formulate a solution in your own words
  • 3. Your answer may look like this:  Take two numbers  Add them  Display the answer (this is your solution in words)
  • 4. Algorithm in words in pseudocode  Take two numbers  Add them  Display the answer Enter num1 Enter num2 Sum  num1 + num2 Write sum
  • 5. Programming (Turbo Pascal)  Enter num1  Enter num2  Sum  num1 + num2  Write sum Writeln(‘Please enter a number.’); Readln(num1); Writeln(‘Please enter another number.’); Readln(num2); Sum := num1 + num2 ; Writeln(‘The sum of ’ ,num1, ‘and ’ , num2, ‘is ’ ,sum, ‘.’)
  • 6. In Turbo Pascal, your program should look like this: Program sum1; uses crt; var num1, num2, sum: integer; begin clrscr; writeln(‘Please enter a number.’); readln(num1); writeln(‘Please enter another number.’); readln(num2); sum:= num1 + num2; writeln(‘The sum of ‘ ,num1, ‘ and ‘ , num2, ‘ is ‘ ,sum, ‘.’) ; readln end.