Algorithm and Flowchart PDF

Document Details

Uploaded by Deleted User

Tags

algorithm flowchart programming computer science

Summary

This document provides an introduction to algorithms and flowcharts in programming. The document outlines the concept, advantages, and limitations of both alongside examples and exercises.

Full Transcript

ALGORITHM AND FLOWCHART PROGRAMMING ALGORITHM Set of instructions/rules to be followed by a computer program. Which should contain an Input, Process and an Output. Depending on the problem to be solved FLOWCHART: A method that allows a programmer to represent the Algorithm in a diagram or an illu...

ALGORITHM AND FLOWCHART PROGRAMMING ALGORITHM Set of instructions/rules to be followed by a computer program. Which should contain an Input, Process and an Output. Depending on the problem to be solved FLOWCHART: A method that allows a programmer to represent the Algorithm in a diagram or an illustration It represents the sequence of a programming algorithm by using standard graphic symbols that will represent the Input, Process and the Output. ADVANTAGES AND LIMITATION OF FLOWCHARTS There are advantages and limitation in the use of flowcharts. Among its advantages are: 1. Since flowcharts are language independent they can be learned and applied without formal knowledge of a programming language. 2. It enforces users to give attention to significant matters over the less significant ones. 3. Flowcharts are easier to understand than a program written in a particular programming language. ADVANTAGES AND LIMITATION OF FLOWCHARTS Among its limitations are: 1. Flowcharts do not represent a programming language and are more of a person-to-person than person-to-computers means of communication. A computer cannot accept a program describe in flowcharting form. 2. Certain details often require along sequence of interconnected symbol which could easily be described in just a few lines of explanations. 3. It does not convey why a given set of operation is made. TYPES OF FLOWCHARTS The two major types of flowcharts are the program and system flowcharts. 1. Program flowchart A program flowchart describes graphically in detail the logical operations and steps within a program and the sequence in which these steps are to be executed for the transformation of TYPES OF FLOWCHARTS 2. System Flowchart A graphic representation of the procedures involved in converting data on input media to data in output form. It illustrates which data is used or produced at various points in a sequence of operations. System flowcharts portray the interaction among data, hardware, and personnel. The emphasis is on the media used and the workstations through which the data passes. Since it illustrates more on the components of the system used, little is shown about how processing will be BASIC SYMBOLS These symbols are the ones often used to create a diagram that represents an algorithm that a computer program must follow. START FLOWLINE OR END On-page PROCESS ELLIPSE connecto r CIRCLE RECTANGLE INPUT OR OUTPUT Off-page DESCISIO PARALLELOGRAM connecto N r DIAMOND INPUT / OUTPUT SYMBOL Represents an instruction to a input or an output operation. INPUT OR OUTPUT PARALLELOGRAM PROCESSING SYMBOL Represents a group of program instructions that perform a processing function of the program such as to perform arithmetic operations, or to compare, sort, etc. PROCESS RECTANGLE DECISION SYMBOL Denotes a point in the program where more than one path can be taken DESCISION DIAMOND OFF-PAGE CONNECTOR Used to connect flowchart portion on different page Off-page connector TERMINAL SYMBOL Used to designate the beginning and the end of a program, or a point of interruption. START OR END ELLIPSE ON-PAGE CONNECTOR Non-processing symbol which is used to connect one part of a flowchart to another without drawing flowlines. 1 CIRCLE FLOWLINES Used to show reading order or sequence in which flowchart symbols are to be read. NOTATIONS USED IN FLOWCHARTING PROGRAMMING PROBLEM 1. Create a program that will display the sum of 2 numbers inputted by the user. Pseudocode: Let numOne = 0, numTwo = 0, and sum = 0 Input numOne and numTwo sum = numOne + numTwo Output sum PROGRAMMING PROBLEM 2. Create a program that will display “Even or Odd” depending on the number inputted by the user. Pseudocode: Let num = 0 Input num If num is an Even number output “Even” If num is an Odd number output “Odd” PROGRAMMING PROBLEM 2. Draw a flowchart that will input the name and value for the grade of a student. Determine whether the grade is passed or failed, passing grade is 75%. Print the name, grade and remarks of the students. 3. Draw a flowchart that will compute for the general average of the four major exam of the student. Consider the following: prelim = 20%, midterm= 20%, semi = 20% and final = 40%. EXERCISES: FLOWCHART 1.Draw a flowchart that will display the average of 3 numbers inputted by the user. 2. Draw a flowchart that will display the product of 3 numbers inputted by the user. 3. Draw a flowchart that will compute for the gross pay of an employee. Input the rate per hour, number of hours worked, name and position of the employee. Display the name, position and gross pay. THANK YOU 

Use Quizgecko on...
Browser
Browser