Flowchart.

Slides:



Advertisements
Similar presentations
C Programming Technique – Firdaus-Harun.com
Advertisements

ALGORITHMS AND FLOWCHARTS
CS 240 Computer Programming 1
Nested if-else Statements.  Should be indented to make the logic clear.  Nested statement executed only when the branch it is in is executed. For example,
Representing an algorithm using Flowcharts
PROBLEM SOLVING TECHNIQUES
1 Flowchart. 2 Flowchart: It is a diagram consists of symbolic block that represents the algorithm step by step Symbols of flowchart: 1. Terminal (start,
UNIT 2. Introduction to Computer Programming
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Subject: Information Technology Grade: 10
Fundamentals of Algorithms MCS - 2 Lecture # 4
Chapter 2- Visual Basic Schneider
Decisions (Conditional Programming) Chapter 5 (Sec. 5.1 & 5.2)
Developing logic (Examples on algorithm and flowchart)
Flowchart Tutorial.
1 Algorithm…. 2 Algorithm: Is a planned set of steps to solve certain problem Ex.: Assume for instance that the gross pay of an employee is to be calculated.
ALGORITHMS AND FLOWCHARTS
Flow Charting. Goals Create Algorithms using Flow Charting procedures. Distinguish between Flow Charting and Pseudocode. Top-Down Design Bottom-up Design.
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.
PSEUDOCODE C Programming Technique – Firdaus-Harun.com.
ALGORITHMS AND FLOWCHARTS CSCI 105 – Computer Fluency.
Basic Control Structures
Basic problem solving CSC 111.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
`. Lecture Overview Structure Programming Basic Control of Structure Programming Selection Logical Operations Iteration Flowchart.
1 Programming Tools Flowcharts Pseudocode Hierarchy Chart Direction of Numbered NYC Streets Algorithm Class Average Algorithm.
(C)opyright 2000 Scott/Jones Publishers Introduction to Flowcharting.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
CSC 111. Solving Problems with Computers Java Programming: From Problem Analysis to Program Design, Third Edition3 Solving Problems Stages 1.Problem.
Introducing block scheme programming March 17. Algorithm / Flow chart An algorithm or a flowchart is a step-by-step procedure for solving a particular.
FLOWCHARTING AND ALGORITHMS
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
Decision making If.. else statement.
Programming – Algorithms (Flowcharts)
Algorithm & Flowchart.
Program design Program Design Process has 2 phases:
ALGORITHMS AND FLOWCHARTS
GC101 Introduction to computers and programs
Amalan Kejuruteraan Sem /2014
Flowchart Symbols Terminal Process Input/ Output Decision
Chapter 2- Visual Basic Schneider
ALGORITHMS AND FLOWCHARTS
Introduction to Computing
Computer Programming Flowchart.
Algorithms and Flowcharts
Introduction to Flowcharting
Numbering System TODAY AND TOMORROW 11th Edition
ALGORITHMS & FLOWCHARTING II
Introduction to Flowcharting
Programming Logic n Techniques
ALGORITHMS AND FLOWCHARTS
Control Structure Senior Lecturer
Structured Program Design
ALGORITHMS AND FLOWCHARTS
Chapter 2- Visual Basic Schneider
Introduction to Algorithms and Programming
Decision making If statement.
` Structured Programming & Flowchart
Faculty of Computer Science & Information System
Chapter 2- Visual Basic Schneider
Introduction to Algorithms - 1
Flowcharts and Pseudo Code
Introduction to Programming
Start or end of algorithm: Action/process step:
Developing a Program.
Introduction to Flowcharting
Introduction to Algorithms - 2
Introduction to Algorithms - 2
Presentation transcript:

Flowchart

Flowchart: It is a diagram consists of symbolic block that represents the algorithm step by step Symbols of flowchart: Terminal (start, stop) Input / output Processing Flow: concerned with direction Decision: for logic comparison Connector Off-page connector

Flowchart: Ex: draw the flowchart for this algorithm: Begin start stop Read name, mark print name, new_mark New_mark = mark+5 Ex: draw the flowchart for this algorithm: Begin startstopRead name, markprint name, new_markNew_mark = mark+5 input name, mark new_mark = mark+5 print name, new_mark End

studentcount = studentcount +1 Flowchart: start stop print name, new_mark studentcount =1 new_mark = mark + 5 studentcount = studentcount +1 A studentcount <= 10 Read name, mark Ex: draw the flowchart for this algorithm: Begin studentcount =1 if studentcount > 10 then Stop else read name, mark calculate new_mark = mark + 5 print name, new_mark studentcount = studentcount +1 goto step 3

Flowchart: F = x2 –y + x else if (L=0) then F = 2x + y start Write F x2 –y + x L=0 stop Read x, y, L (x / y) + 10 L< 0 2x + y yes No Ex: Draw a flowchart to compute: F = x2 –y + x L<0 2x + y L=0 (x / y) + 10 L>0 start read x, y, L if (L<0) then F = x2 –y + x else if (L=0) then F = 2x + y F = (x / y) + 10 write F stop

Flowchart: Ex: Trace the following flowchart to find the value of max and min variable for 4 numbers order as follows (x = 4, 2, 1, 3)? start Read n Max=x Min=x b stop I = I +1 I<=n Read x I = 2 A Max<x Min>x Max = x Min = x yes No

Flowchart: Ex: Read name for student, when name="xxx" stop the program, if name does not equal "xxx" then compute the grade of every student. Every student has five courses. The average for the student courses has to be computed and there by the grade is given. Avg > = 90 ------------------------> grade = 'A' 80 < =Avg < 90 ------------------------> grade = 'B' 70 < =Avg < 80 ------------------------> grade = 'C' 60 < =Avg < 70 ------------------------> grade = 'D' Avg < 60 ------------------------> grade = 'F'

if ((avg >=80) and (avg < 90)) then grade = 'B' Sol: Start read name while (name != "xxx") do begin total = 0 for count = 0 to 5 do read mark total = total + mark end avg = total / 5 if ( avg >= 90) then grade = 'A' else if ((avg >=80) and (avg < 90)) then grade = 'B' if ((avg >=70) and (avg < 80)) then grade = 'C' if ((avg >=60) and (avg < 70)) then grade = 'D' Grade = 'F' Write name, grade stop

((avg >=80) and (avg < 90)) start Read name total= 0 Count= 0 Name = "xxx" B A stop yes No Read mark total= total + mark count= count + 1 count < 5 avg = total / 5 avg > = 90 ((avg >=80) and (avg < 90)) ((avg >=70) and (avg < 80) ((avg >=60) and (avg < 70)) Write name, grade C Grade='A' Grade='B' Grade='C' Grade='D' Grade='F'