0% found this document useful (0 votes)
14 views

03_Algorithms_II

Uploaded by

Destiny
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

03_Algorithms_II

Uploaded by

Destiny
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Algorithms II

CEN111 Algorithms and Programming I


Basic Control Structures
• Sequence

• Selection

• Loop
Basic Control Structures

• Sequence
• Steps that execute in sequence are
represented by symbols that follow
each other top to bottom or left to
right.
Basic Control Structures

• Selection
• Once the condition is evaluated, the
control flows into one of two paths.

• Once the conditional execution is


finished, the flows rejoin before leaving
the structure.
Basic Control Structures

• Loop
• Either the processing repeats or the
control leaves the structure.
Algorithms

• Prepare a flowchart to read the marks of a student and classify


them into different grades. If the marks secured are greater than or
equal to 90, the student is awarded Grade A; if they are greater
than or equal to 80 but less than 90, Grade B is awarded; if they are
greater than or equal to 65 but less than 80, Grade C is awarded;
otherwise Grade D is awarded.
Algorithms

• Draw a flowchart to find the sum of the first 50 natural numbers.


Algorithms

• Develop the algorithm for finding the sum of the series 1 + 2 + 3 + 4 +


… up to N.
Algorithms

• Develop the algorithm for finding the sum of the series 2 + 4 + 6 + …


up to N.
Homework

• Draw a flowchart to find the roots of a quadratic equation.

• Draw a flowchart to find the greatest common divisor of two given


number.

You might also like