Terminator Start/Begin Stop/End
Data in/out
Data in/out
Process Multiply/add
Decision x>y?
Flow
Connector
E.g. Develop a flow chart to display the result of adding two input numbers.
Start
Input num1
Input num2
sum ← num1 + num2
sum
Stop
Start
Output “First Number?”
Input num1
Output “Second Number?”
Input num2
sum ← num1 + num2
Output “The result of adding
two numbers is”, sum
Stop
Draw a flow chart to show the result of multiplying the input number by 5. The system must:
- Ask the user to input a number
- Multiply it by 5
- Display the stored result
Start
Output “Type a number”
Input num
ans ← num * 5
Output “Your result is”, ans
Stop
E.g. Develop a flow chart to decide the given input is even or odd.
Begin
Output “Enter a number”
Input num
remainder ← num%2
Yes No
remainder == 0?
Output “The given Output “The given
number is even.” number is odd.”
End
Draw a flowchart for the system which performs:
- the user to input two numbers
- add the two numbers
- decide whether the addition result is even or odd
- if even, multiply the addition result by 2
- if odd, multiply the addition result by 3
- then display the final result
Begin
Output “Enter the first number”
Input num1
Output “Enter the second number”
Input num2
sum = num1 + num2
remainder = sum%2
Yes No
remainder == 0?
result = sum * 2 result = sum * 3
Output “The final result is”, result
End
Draw a flowchart for the system which performs:
Step 1. the user to input two numbers
Step 2. add the two numbers
Step 3. decide whether the addition result is even or odd
Step 4. if even, go back to Step 1 again
Step 5. if odd, display the result
Begin
Output “Enter the first number”
Input num1
Output “Enter the second number”
Input num2
sum = num1 + num2
remainder = sum%2
Yes
remainder == 0?
No
Output “The result is”, sum
End
Draw a flowchart for the system which performs:
Step 1. the user to input two numbers
Step 2. add the two numbers
Step 3. decide whether the addition result is even or odd
Step 4. if even, go back to Step 1 again
Step 5. if odd, display the number of loops
Begin
count = 0
Output “Enter the first number”
Input num1
Output “Enter the second number”
Input num2
sum = num1 + num2
count = count + 1
remainder = sum%2
Yes
remainder == 0?
No
Output “The number of loop is”, count
End
Draw a flowchart for the system which performs:
– the user to input random number between 0 and 100
– repeat asking the user until the input number is 88
– display how many time the user guessed to get the correct number
Begin
count = 0
Output “Enter a number between 0 and 100
Input num
count = count + 1
false
num == 88
true
Output “You can guess the correct
number within”, count
Begin
Draw a flow chart to
- input the mark of three subjects
- find the total mark
- find the grade (average is: 80 and above for Grade A, 79 to 65 for Grade B, 64 to 40 for Grade C
and below 40 for Grade D)
- display the total mark and grade
Begin
Output “Enter the first subject”
Input sub1
Output “Enter the second subject”
Input sub2
Output “Enter the third subject”
Input sub3
total = sub1 + sub2 + sub3
avg = total / 3
avg
avg >= 80 avg < 40
80 > avg >= 65 65 > avg >= 40
Output Output Output Output
total, total, total, total,
“Grade A” “Grade B” “Grade C” “Grade D”
End
Draw a flow chart to
- input three subjects
- find total mark
- decide pass or fail
- display the total and pass or fail
Begin
Output “Enter the first subject”
Input sub1
Output “Enter the second subject”
Input sub2
Output “Enter the third subject”
Input sub3
total = sub1 + sub2 + sub3
true false
sub1 > = 40 AND sub2 >= 40
AND sub3 >= 40
Output “The total Output “The total
mark is”, total, “Fail”
mark is”, total, “Pass”
End
Draw a flow chart to find the sum of all positive numbers between 1 and 100.
Begin
num = 0
ans = 0
ans = ans + num
num = num + 1
false
num > 100
true
Output “The sum of positive
numbers between 0 and 100 is”, ans
End
Draw a flow chart to find the product of all positive numbers between 1 and 100.
1. Draw a flow chart to show the result of multiplying two input numbers.
2. Draw a flow chart to find the sum of positive integers until the result is less than 1000.
3. Draw a flow chart for the system which
o ask the user to input the user name and password
o check whether the password is “Password”
▪ If the password is correct then display the user name and no. of time to retype
▪ If the password is incorrect then ask the user to retype the password
4. Draw the flow chart to
o find the average of three input numbers
▪ if the average is lower than 40 then display “Poor”
▪ if the average is between 40 and 70 then display “Medium”
▪ if the average is above 70 then display “High”
5. Draw the flow chart to
o input the marks of three subjects
o find the total mark
o decide Pass or Fail (use pass mark = 40)
o display the total mark and pass/fail