انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

programming fundamental -l2

الكلية كلية العلوم للبنات     القسم قسم الحاسبات     المرحلة 1
أستاذ المادة ماجد جبار جواد الفنهراوي       13/12/2015 16:12:48
1. Algorithm:
As stated earlier an algorithm can be defined as a finite sequence of
effect statements to solve a problem. An effective statement is a clear,
unambiguous instruction that can be carried out .Thus an algorithm should
special the action to be executed and the order in which these actions are to
be executed.
Algorithm properties:
? Finiteness: the algorithm must terminate a finite number of steps.
? Non-ambiguity: each step must be precisely defined. At the
completion of each step, the nest step should be uniquely determined.
? Effectiveness: the algorithm should solve the problem in a reasonable
amount of time.
Example 1: Develop an algorithm that inputs a series of number and output
their average .
A computer algorithm can only carry out simple instruction like:
? "Read a number".
? "Add a number to anther number".
? "Output a number".
Thus an algorithm is:
1. Carry out initialization required.
2. Read first number.
3. While the number of numbers is not complete do
4. begin
5. Add the number to the accumulated sum.
6. increment the count of numbers entered.
LECTURE 2
LESSON TWO
7. Read next number.
8. End
9. Evaluate the average.
Example 2: Devolve an algorithm that allows the user to enter the count of
numbers in a list followed by these numbers. The algorithm should find and
output the minimum and the maximum numbers in the list.
An algorithm for this might be:
? Initialize.
? Get count of numbers.
? Enter numbers and find maximum and minimum .
? Output result.
The user might enter zero for the count. To deal with this case the above
general case can be extended as follows to be an algorithm:
1. Initialize the require variables.
2. Get count of numbers.
3. If count is zero then exit.
4. Otherwise begin.
5. Enter numbers.
6. Find max and min.
7. Output result.
8. End.
2. Flowcharts
A flowchart is a graphical representation of an algorithm or of a portion
of an algorithm .Flowcharts are drawn using symbols. The main symbols used
to draw a flowchart are shown in following figure.
LESSON TWO


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .