SITJAR, John Oliver S.
Assignment:
BMCE 2 / 2022103009 Algorithm Design and Flowchart
1. Input two numbers and calculate their sum
ALGORITHM:
a) Start
b) Input the first number (num1)
c) Input the second number (num2)
d) Calculate the sum: sum = num1 + num2
e) Output the sum
f) End
g)
START
Input x
Input y
Sum = x + y
Print SUM
2. Input a temperature in Fahrenheit and convert it to Celsius.
ALGORITHM;
A. Start
B. Input the temperature in Fahrenheit (temp_f)
C. Convert Fahrenheit to Celsius: temp_c = (temp_f - 32) * (5/9)
D. Output the temperature in Celsius (temp_c)
E. End
START
Input
Temperature in Celsius
Convert Fahrenheit to Celsius:
= (Temperature in Fahrenheit - 32) * (5/9)
Print result in
Temperature in Celsius
3. Input a list of numbers and find the second-largest number in the list. For example,
given the list: [5, 12, 8, 17, 3, 15], the second-largest number is 15.
ALGORITHM:
a) Input a list of numbers (should be real numbers and is separated by “,”) (INPUT)
b) If the list of numbers is < 2, then display an error and start over again. (PROCESSING)
c) If the list of numbers is > 2, then proceed to the next step. (PROCESSING)
d) Find the largest number in the list (PROCESSING)
e) Second largest number = number that is the largest but is less than the largest number in the
list. (PROCESSING)
f) Display the second largest number (OUTPUT)
START
Insert a list of Input
numbers
Processing List of
numbers < 2
Display an error
Processing
message
Processing Find the largest
number
FIND THE SECOND LARGEST
NUMBER
Processing (Largest number > Second
largest number > Rest of the
numbers)
Output Display second
largest number
END