introduction to computing lecture 03: introduction to ... sum to zero while ... calculate average =...
TRANSCRIPT
![Page 1: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/1.jpg)
Introduction to Computing
Lecture 03: Introduction to Algorithms and
Flowcharts (continued)
Assist. Dr. Nükhet ÖZBEK
Ege University
Department of Electrical&Electronics Engineering
![Page 2: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/2.jpg)
Expressing Algorithms
• Natural Languages
• Pseudocode
• Flowcharts
• Programming Languages
![Page 3: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/3.jpg)
Natural Language Algorithm Cilbir • 6 eggs • ½ kg yogurt • 3 large garlic cloves • 4 Tbs fresh butter • 1 tsp red pepper, coarsely ground • 2 middle-sized onions cut horizontally • plenty water
• Boil water in a fairly big pot. Break one by one the eggs and pour them in a
plate, being careful not to break the yolk. To ensure a homogenous cooking, let them “glide” from the plate into the boiling water. Within three minutes the eggs are ready but if you prefer hard-boiled, allow them to cook for another minute or so.
• Meanwhile brown the butter in a skillet and add the garlic and onion. In the last possible moment add the coarsely ground red pepper and turn off the fire. Remove the eggs from the pot using a skimmer and place them in a deep plate.
• Cover the eggs with plenty of yogurt and pour the hot butter over them. Serve immediately.
From www.gourmet.gr
![Page 4: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/4.jpg)
Pseudocode Algorithm Example
Set moveCount to 1
FOR each row on the board
FOR each column on the board
IF gameBoard position (row, column) is occupied THEN
CALL findAdjacentTiles with row, column
INCREMENT moveCount
END IF
END FOR
END FOR
![Page 5: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/5.jpg)
Algorithm Example
Set number counter to zero
Set sum to zero
While (number counter < 10)
{ input a number
Sum = Sum + Number
increment number counter by 1
}
Calculate average = sum / 10
![Page 6: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/6.jpg)
Labwork 1
• Write an algorithm to calculate the area of circle
![Page 7: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/7.jpg)
Labwork 1
Input radius
Set pi = 3.14
Calculate area = pi * radius * radius
![Page 8: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/8.jpg)
Labwork 2
• Write an algorithm to calculate the sum of multiples of 3 up to 100
![Page 9: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/9.jpg)
Labwork 2
Set number counter to zero
Set sum to zero
While (number counter < 100)
{
Sum = Sum + Number counter
increment number counter by 3
}
![Page 10: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/10.jpg)
Flowcharts
• Flowcharts are schematic representations of processes
• Generally the start point, end points, inputs, outputs, possible paths and the decisions that lead to these possible paths are included
• Flow-charts can be created by hand or manually in most office software, but lately specialized diagram drawing software has emerged that can also be used for the purpose
![Page 11: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/11.jpg)
Flowchart Symbols (Mostly Used)
• Start / End symbol
• Arrows
• Processing steps
• Input/Output
• Conditional (Decision)
![Page 12: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/12.jpg)
Flowchart Symbols (Others)
• Document
• Magnetic Tape
• Display
• Manual Input
![Page 13: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/13.jpg)
Flowchart Example
From wikipedia.org
![Page 14: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/14.jpg)
Flowchart Example
From smartdraw.com
![Page 15: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/15.jpg)
Flowchart Example
Read NAME, BALANCE, RATE Compute INTEREST as BALANCE x RATE Write (Display) NAME and INTEREST
![Page 16: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/16.jpg)
Flowchart Example
From wikipedia.org
![Page 17: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/17.jpg)
Flowchart Example START
Input N
Sum =0 C = 0
Input number
Sum = Sum + number C = C + 1
C = N?
A = Sum / N
END
No
Yes
Print A
![Page 18: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/18.jpg)
Labwork 3
• Draw a flowchart to find the sum of first 50 counting numbers
![Page 19: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/19.jpg)
Labwork 3
![Page 20: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/20.jpg)
Labwork 4
• Draw a flowchart to find the largest of three numbers A,B, and C.
![Page 21: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/21.jpg)
Labwork 5
• Draw a flowchart to find the product of two numbers using only addition operation
![Page 22: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/22.jpg)
Labwork 5
![Page 23: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/23.jpg)
Labwork 6
• Draw a flowchart to find the division of two integer numbers using only subtraction operation. Find the division and remainder.
![Page 24: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/24.jpg)
Labwork 6
![Page 25: Introduction to Computing Lecture 03: Introduction to ... sum to zero While ... Calculate average = sum / 10 . ... •Draw a flowchart to find the product of two numbers using only](https://reader036.vdocuments.mx/reader036/viewer/2022062908/5adbb5327f8b9a1a088b9663/html5/thumbnails/25.jpg)
Summary
• Problem Solving Process
• Algorithms
• Components of Algorithms
• Flowcharts