4. Example â Add two numbers given by a user
Start
Accept first
input: num1
5. Example â Add two numbers given by a user
Start
Accept first
input: num1
Accept second
input: num2
6. Example â Add two numbers given by a user
Start
Accept first
input: num1
Accept second
input: num2
Sum = num1 + num2
7. Example â Add two numbers given by a user
Start
Accept first
input: num1
Accept second
input: num2
Add = num1 + num2
Print Add
Stop
8. Example â Add two numbers given by a user
Start
Accept first
input: num1
Accept first
input: num2
Add = num1 + num2
Print Add
Stop
9. Example â Add two numbers given by a user
Start
Accept first
input: num1
Accept first
input: num2
Add = num1 + num2
Print Add
Stop
10. Basic flow chart symbols
Symbol Purpose Description
Flow line Indicated the flow from one block
to another
Start/Stop Represents the start and end of the
flow chart
Processing Arithmetic operations
Input/Output Input and output operations
Conditional Decision making block
11. Example â Print the maximum between two
numbers Start
Accept first
number: num1
Accept second
number: num2
as input
Print num1
Stop
If
num1>
num2
Print num2
True False
12. Example â Print the maximum between two
numbers Start
Accept first
number: num1
Accept second
number: num2
as input
Print num1
Stop
If
num1>
num2
Print num2
True False
Verify that the flow chart
works correctly for a few
examples
num1 = 10, num2 = 20
num1 = 15, num2 = 5
13. Exercise: Create a flow chart for this problem
⢠Given 3 numbers, a, b, c, find the maximum value
14. Exercise: Create a flow chart for this problem
⢠Given 3 numbers, a, b, c, find the maximum value
⢠Verify that what your flow chart works correctly
⢠Examples:
⢠a = 10, b = 20, c = 30
⢠a = 15, b = 30, c = 5
⢠a = 40, b =80, c = 120
15. Exercise: Create code
Start
Declare 3
numbers: a, b, c
If a > b
Print b
FalseTrue
If a > c
Print a
If b > cPrint c
Stop
True True
False False
16. Flow Chart: Loops
⢠Ask user to enter a number
⢠Print all even numbers between 0 and the number user entered
22. HW discussion
Start
User inputs a number num1
a = 1
If a <
num1
True Is num1
divisible by
a?
Print itâs a
prime number
Stop
True
Print itâs not a
prime number
a = a+1
23. How do you check if a string is a palindrome?
⢠How do you access different characters of a string?
24. How do you check if a string is a palindrome?
⢠How do you access different characters of a string?
⢠How do you access several characters in a string as a block?
25. How do you check if a string is a palindrome?
⢠How do you access different characters of a string?
⢠How do you access several characters in a string as a block?
⢠Please create a flowchart of how you would check if something is a
palindrome logically. Then use the above two operations to code the
logic.