انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة
الكلية كلية العلوم
القسم قسم الكيمياء
المرحلة 2
أستاذ المادة بيادر عباس حسين الحميري
01/01/2019 15:52:53
Now, if we take definition of algorithm as: “A sequence of activities to be processed for getting desired output from a given input.” Then we can say that: 1. Getting specified output is essential after algorithm is executed. 2. One will get output only if algorithm stops after finite time. 3. Activities in an algorithm to be clearly defined in other words for it to be unambiguous. Before writing an algorithm for a problem, one should find out what is/are the inputs to the algorithm and what is/are expected output after running the algorithm. General Rules for flowcharting 1. All boxes of the flowchart are connected with Arrows. (Not lines) 2. Flowchart symbols have an entry point on the top of the symbol with no other entry points. The exit point for all flowchart symbols is on the bottom except for the Decision symbol. 3. The Decision symbol has two exit points; these can be on the sides or the bottom and one side. 4. Generally a flowchart will flow from top to bottom. However, an upward flow can be shown as long as it does not exceed 3 symbols. 5. Connectors are used to connect breaks in the flowchart. Examples are: • From one page to another page. • From the bottom of the page to the top of the same page. • An upward flow of more then 3 symbols 6. Subroutines and Interrupt programs have their own and independent flowcharts. 7. All flow charts start with a Terminal or Predefined Process (for interrupt programs or subroutines) symbol. 8. All flowcharts end with a terminal or a contentious loop. Advantages and Disadvantages of Flow Chart Advantages 1. Communication: Flow Charts are better way of communicating the logic of a system to all concerned. 2. Effective Analysis: With the help of flow chart, problem can be analyzed in more effective way. 3. Proper Documentation: Program flow charts serve as a good program documentation, which is needed for various purposes. 4. Efficient Coding: The flow charts act as a guide or blueprint during the systems analysis and program development phase. 5. Proper Debugging: The flow chart helps in debugging process. 6. Efficient Program Maintenance: The maintenance of operating program becomes easy with the help of flow chart. It helps the programmer to put efforts more efficiently on that part. Disadvantages Complex logic: Sometimes, the program logic is quite complicated. In that case, flow chart becomes complex and clumsy. 1. Alterations and Modifications: If alterations are required the flow chart may require redrawing completely. 2. Reproduction: As the flow chart symbols cannot be typed, reproduction of flow chart becomes a problem. 3. The essentials of what is done can easily be lost in the technical details of how it is done. H.W. Write an algorithm and draw a flow chart to calculate the factorial of a number (N). Verify your result by a trace table by assuming N = 5. Hint: The factorial of N is the product of numbers from 1 to N. H.W. Write an algorithm and draw a flowchart to calculate 24 . Verify your result by a trace table. H.W. Write down an algorithm and draw a flowchart to find and print the largest of three numbers. Read numbers one by one. Verify your result by a trace table. (Use 5, 7, 3 as the numbers read) H.W. Write an algorithm and draw a flowchart to print the square of all numbers from 1 to10. H.W. Write an algorithm and draw a flowchart to print the SUM of numbers from LOW to HIGH. Test with LOW=3 and HIGH=9. H.W. Write an algorithm and draw a flowchart to print all numbers between LOW and HIGH that are divisible by NUMBER. H.W. Draw a flowchart for a program that reads 10 numbers from the user and prints out their sum, and their product.
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الىلوحة التحكم
|