BUILDING BLOCKS OF ALGORITHMS

In this algorithm, also, it may be noted that only the variable SUM is initialized. The
variable x is not initialized explicitly. The variable x is implicitly initialised to 1
through the construct ‘for x varying from 1 to n do’. And, after each execution of the
body of the for-loop, x is implicitly incremented by 1.
A noticeable feature of the constructs (structuring rules) viz., sequencing, selection
and iteration, is that each defines a control structure with a single entry point and
single exit point. It is this property that makes them simple but powerful building
blocks for more complex control structures, and ensures that the resultant structure remains comprehensible to us.
Structured Programming, a programming style, allows only those structuring rules
which follow ‘single entry, single exit’ rule.

Ex.4) Write an algorithm that finds the real roots, if any, of a quadratic equation
ax2 + bx + c = 0 with a ≠ 0, b, c as real numbers.

Ex.5) Extend your algorithm of Ex. 4 above to find roots of equations of the form
ax2 + bx +c = 0, in which a, b, c may be arbitrary real numbers, including 0.

Ex.6) (i) Explain how the algorithm Sum_First_N_2 finds the sum of the first 3
natural numbers.
(ii) Explain how the algorithm Sum_First_N_3 finds the sum of the first 3
natural numbers.

Beautiful love Massage for Your Love One
Richard Cory EA Robinson
La violencia sexual en el vecindario daña la salud mental en las mujeres

 

 

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!