0% found this document useful (0 votes)
12 views1 page

Lab 1 - Flowchart

Uploaded by

haidangnha1412
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

Lab 1 - Flowchart

Uploaded by

haidangnha1412
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Lab 1 – Flowchart

a) Example:
- Ex1: Draw the flowchart for a program that receives 2 positive integers. Print their sum
if both are even, if not print their product.
- Ex2: Draw the flowchart for a program that receives 3 integers. Print the area of the
triangle containing 3 edges with 3 inputs lengths. If they can’t create a triangle, print 0.
b) Exercises:
- Ex3: Draw a flowchart for the process of recognizing a chemical flask missing its name
using litmus. Knowing that the chemical can be either HCl, NaOH or pure water; the
litmus will change into red, green, no-change respectively when in contact with the
chemical, assuming that HCl and NaOH are dense enough to change the litmus color.
- Ex4: Draw a flowchart for a program that solving the quadratic equation with input a, b,
c. ax^2 + bx +c = 0 (a!=0)
Only solve for real numbers of roots, if there are no real roots print “no real roots” and
end the program.
- Ex5: Draw a flowchart to determine if an input year is leap year. Knowing that
algorithm to determine the leap year are as below:
if (year is not divisible by 4) then (it is a common year)
else if (year is not divisible by 100) then (it is a leap year)
else if (year is not divisible by 400) then (it is a common year)
else (it is a leap year)

You might also like