Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

FSC1331 – Introduction to Programming Tutorial

Chapter 3 – Flowchart

1. Draw a flowchart to represent the logic of a program that accepts the input of a series of
numbers. The program will display the “Even number” if the number entered is an even
number otherwise the program will display the “Odd number”.
Hint : apply % to find an even or odd number

Notes : 1) Read number 2) Number checked 3) Result

2. Add the following logic to the flowchart that you had created in Q1. The program will add
up all even number until 999 is entered. The number of data entered, number of even
numbers and the total of even numbers will be displayed.
Notes : 1) Read number 2) Test if number is 999 3) if999> count num entered,
4) ifnot999 test even and odd number 5) ifeventrue add up even num, count even
num

3. Design a program flowchart based on the following scenario; Prompt the user to enter
his/her name and age and determine whether he/she is an adult or not. If he/she is below
21 years old, the user would be a teenager else he/she would be an adult. The user would
be prompted after each person, if he/she wishes to enter anymore name. The program
continues to run until the user enters “No” or “N”.
Notes : 1) Enter name and age 2)Test age 3) ifage>=21 isadult 4) ifnot isteenager
5)continueprogram 6)ifcontinue is No/N end program

4. Assume you have bank account that compounds interest on a yearly basis. For example, if
you deposit $100 for two years at 4 percent interest, at the end of one year you will have
$104. At the end two years, you will have the $104 plus 4 percent of that, or $108.16.
Using flowchart, draw the logic for a program that would read in a deposit amount, a term,
and an interest rate, and print out the running total for each year of the amount.
Hint : Apply formula ( Future value, FV = PV (1 + Interest) Y )

Notes: 1) Read deposit amount, year, interest rate 2) Find total > ifyear>0 calculate total
each year 3) ifnot display new amount

1/2
FSC1331 – Introduction to Programming Tutorial

5. Draw a flowchart for a program that accepts an amount entered through the keyboard.
Then, determined the discount rate allowed; 20% would be given to any purchase of more
than $1000, 10% to purchase of more than $500 (inclusive). Display the discount given and
also the amount after the deduction of the discount.

2/2

You might also like