Chapter 1: Problem Solving Skills Introduction to Programming GENG 200

Size: px
Start display at page:

Download "Chapter 1: Problem Solving Skills Introduction to Programming GENG 200"

Transcription

1 Chapter 1: Problem Solving Skills Introduction to Programming GENG 200 Spring 2014, Prepared by Ali Abu Odeh 1

2 Table of Contents Fundamentals of Flowcharts 2 3 Flowchart with Conditions Flowchart with Looping Expected Chapter Duration: 3 classes. Part 1 will be covered at the beginning of the course. Part 2 will be covered at the beginning of chapter 4. Part 3 will be covered at the beginning of chapter 5. Spring

3 Part 1: Fundamentals of Flowcharts Spring

4 Fundamentals of Flowcharts A flowchart is a type of a graphical diagram that represents an algorithm or process, showing the steps as shapes of various kinds, and their order by connecting them with arrows. This diagrammatic representation illustrates a solution to a given problem. Process operations are represented in these shapes, and arrows; rather, they are implied by the sequencing of operations. Spring

5 Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields. writing a procedure or a computer program to perform a certain task requires the need to organize the procedure using step-by-step instructions. Spring

6 1.2 Flowchart standards and shapes» When you draw a flowchart you must use standard shapes to represent each step in the procedure.» You usually draw the flow from top to bottom or from left to right.» Arrows connect the shapes to define the direction of the flow.» To draw a flowchart, a paper can be used or Microsoft Visio or the flowchart tool in Microsoft Word. Spring

7 Shape Meaning Shape: Arrow Shape: Oval Job: (Flow direction) Job: (Begin, End) Shape: Rectangle Job: Task (Process) Shape: Parallelogram Job: (Input, Output) Shape: Diamond Job: (Decision, Condition) used for Branching or Repeating Shape: Circle Job: (Connector) Spring

8 Key Points to draw flowchart» Brainstorm the tasks and decisions made during a process, and write them down in order.» Then map these out in flow chart format using appropriate symbols for the start and end of a process, for actions to be taken and for decisions to be made.» Finally, challenge your flow chart to make sure that it's an accurate representation of the process, and that it represents the most efficient way of doing the job. Spring

9 Example 1: Design a flowchart to calculate the area of a parallelogram given by this equation: area = base*height The flowchart for this procedure is as follows: h b Spring

10 Solution 1: begin get base get height area = base*height Output area End Spring

11 Solution 2: begin get base and height area = base*height Output area End Spring

12 Example 2: Design a flowchart to calculate the area of an octagon given by this equation: Area = 8tan(π/8)r 2 The flowchart for this procedure is as follows: Spring

13 Solution 1: begin pi = 3.14 get r area = 8 * tan (pi/8)*r 2 Output area End Spring

14 Solution 2: begin get r area = 8 * tan (3.14/8)*r 2 Output area End Spring

15 Practice 1: Draw a flowchart that will calculate the area of a trapezoid. b1 h Trapezoid area = ½ * h * (b1+b2) b2 Spring

16 Part 2: Flowchart with Conditions Spring

17 Flowchart with Decisions (Conditions) In real life it is typical that you have to choose between two options based on a certain parameter. An example is to decide to go to school by car or on foot. False/No Is Distance > 1.0 km? Go on foot True/Yes Go by car Spring

18 The previous flowchart may also be drawn as shown. False/No Is Distance > 2.0 km? True/Yes Go on foot Go by car Spring

19 » Usually the test (decision) achieved by asking certain questions, in English language referred to YES/NO question.» In computer languages they known as Boolean expressions; where the expression must have only two possible answers TRUE/FALSE.» These types of decisions can be constructed using set of operations like (=, <,<=, >, >=) Spring

20 » For example the following questions are valid in constructing decisions; is 4 < 3? is C > c? is num1 = num2? is counter <= 10?» The program will take a set of actions (or will skip them) based on the answer to the question, which will cause the program to flow into one of two possible branches. Spring

21 Flowchart with IF-Then construct The IF... THEN is shown here and is also known as the NULL else, meaning, that there is no else part. False if Condition True Process Spring

22 Example 3: Assume that the sides of a polygon are a1, a2, b1, and b2. If a1 = a2, b1 = b2, and a1 b1 then this polygon is a rectangle. Draw or design a flowchart to solve the problem. a1 b1 b2 a2 Spring

23 begin get a1,a2,b1,b2 is a1 = a2 and b1 = b2 and a1 b1 True / Yes False / No output "Polygon is rectangle" end Spring

24 The condition can be written in these way s: is a1 == a2 and b1 == b2 and a1!= b1 is a1 == a2 && b1 == b2 && a1!= b1 Spring

25 Flowchart with If-Else Construct A second variation of Decisions executes one block if the decision is true and another block if the decision is false. The only difference is that each value of the decision has a process associated with it. False if Condition True Process 2 Process 1 Spring

26 Example 4: Let s reconsider example 3 again, this time if the condition is false, then, the polygon is a square. Note: Yes means True and No means False. Spring

27 begin get a1,a2,b1,b2 is a1 = a2 and b1 = b2 and a1 b1 true false output "Polygon is square" output "Polygon is rectangle" end Spring

28 Flowchart with nested decisions A third variation of the decisional flowcharts uses several decisions (some time referred to as nested decisions), this construct at least has two decisions inside each other, if the result of the first test question is FALSE then the second question is tested.etc. until one test question evaluates to TRUE. Spring

29 False IF Condition 1 TRUE False IF Condition 2 TRUE PROCESS 1 IF Condition 3 TRUE PROCESS 2 False PROCESS 3 PROCESS 4 Spring

30 Example 5: Let s reconsider example 3 again, this time, you need to have a new branch if the polygon is not rectangle or square.» Nested if must be used here. Spring

31 begin get a1,a2,b1,b2 False is a1 = a2 and b1 = b2 and a1 b1 True is a1 = a2 and b1 = b2 and a1 = b1 output "Polygon is unidentified" True output "Polygon is square" output "Polygon is rectangle" End 31 Spring

32 Practice 2: Draw a flowchart for simulating a college grading system. <60 (F) <65 (D) <70 (D+) <75 (C) <80 (C+) <85 (B) <90 (B+) >=90 (A) Spring

33 Which one is more faster and more efficient? x_type = unknown x = -15 x_type = unknown x = -15 if x > 0 F T x_type = P if x > 0 T F x_type = P if x < 0 T if x < 0 T F x_type = N F x_type = N if x = 0 F T x_type = 0 if x = 0 F T x_type = 0 Spring

34 Practice 3: What is the output? x_type = unknown x = -15 x_type = unknown x = -15 if x > 0 F T x_type = P if x > 0 F T x_type = P if x < 0 T if x < 0 T F x_type = N F x_type = N if x = 0 F T x_type = 0 if x = 0 F T x_type = 0 Spring

35 Part 3: Flowchart with Looping Spring

36 Flowchart with Looping Conditional loops or repetitive control structures are a way for computer programs to repeat one or more various steps depending on conditions set either by the programmer initially or real-time by the actual program. A conditional loop has the potential to become an infinite loop when nothing in the loop's body can affect the outcome of the loop's conditional statement. Spring

37 Generally, the following classification is said to be universal for all looping constructs:» Counter control loops: This construct is used when the number (count) of repetitions (iterations) is known.» Sentinel value loops: This construct is used when the number of repetitions depends on certain value, which might be generated within the loop body or entered by the user. Spring

38 While loop While means (as long as) therefore, looping continues as long as the answer to the test question/condition is True. False Test Condition True PROCESS Spring

39 Example 6: Draw a flowchart that calculates and outputs the sum of the shown series. Ignore all elements whose values are less than y sin x sin x sin x sin x, x 0. 1 Spring

40 y sin x sin x sin x sin x, x 0. 1 x = 0.1 power = 1 z = 0 y = 0 x power z y z = sin (x ^ power) power = power Is z > ? True y = y + z False Spring

41 For loop You can see that there are three parts needed to draw a loop with a counter (termed as for loop):» Initialization of the counter.» Testing of the loop condition against the total count value.» Incrementing the counter each time the loop is executed. Spring

42 Generally, for loops are used when you know in advance the number of iterations. Initialize control variable False Condition (Test control variable) True Process Update control variable Spring

43 Example 7: What is the value of x after leaving the loop for both of them? counter = 0 x = 0 counter = 0 x = 0 counter = counter + 1 x = x + 2 counter = counter + 1 Is counter < 3? False True x = x + 2 Is counter < 3? False True Spring

44 Practice 4: Draw a flowchart that calculates and prints the average of several integers. Assume the last value read is the sentinel A typical input sequence might be indicating that the average of all the values preceding 9999 is to be calculated Spring

45 While or for? Generally, you can use while or for to solve any looping problem however, if you know how many times this loop will keep repeating in advance then, its better to use a for loop otherwise, better to use a while loop. Spring

46 References: - Slides, ERU team of instructors Spring

Problem Solving FLOWCHART. by Noor Azida Binti Sahabudin Faculty of Computer Systems & Software Engineering

Problem Solving FLOWCHART. by Noor Azida Binti Sahabudin Faculty of Computer Systems & Software Engineering Problem Solving FLOWCHART by Noor Azida Binti Sahabudin Faculty of Computer Systems & Software Engineering azida@ump.edu.my OER Problem Solving by Noor Azida Binti Sahabudin work is under licensed Creative

More information

Page 1 of 14 Version A Midterm Review 1. The sign means greater than. > =

More information

FLOWCHARTS A flowchart is a graphical representation of the steps to be followed for solving problem. It consists of a set of symbols.

FLOWCHARTS A flowchart is a graphical representation of the steps to be followed for solving problem. It consists of a set of symbols. FLOWCHARTS A flowchart is a graphical representation of the steps to be followed for solving problem. It consists of a set of symbols. Each symbol represents a specific activity. A typical problem involves

More information

BIL101E: Introduction to Computers and Information systems Lecture 8

BIL101E: Introduction to Computers and Information systems Lecture 8 BIL101E: Introduction to Computers and Information systems Lecture 8 8.1 Algorithms 8.2 Pseudocode 8.3 Control Structures 8.4 Decision Making: Equality and Relational Operators 8.5 The if Selection Structure

More information

Chapter 3 Structured Program Development

Chapter 3 Structured Program Development 1 Chapter 3 Structured Program Development Copyright 2007 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 3 - Structured Program Development Outline 3.1 Introduction

More information

Lecture 7 Tao Wang 1

Lecture 7 Tao Wang 1 Lecture 7 Tao Wang 1 Objectives In this chapter, you will learn about: Interactive loop break and continue do-while for loop Common programming errors Scientists, Third Edition 2 while Loops while statement

More information

CHAPTER 2 PROBLEM SOLVING TECHNIQUES. Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042

CHAPTER 2 PROBLEM SOLVING TECHNIQUES. Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042 CHAPTER 2 PROBLEM SOLVING TECHNIQUES Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042 Software Engineering vs Problem Solving Software Engineering - A branch of Computer Science & provides

More information

Structured Program Development

Structured Program Development Structured Program Development Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Outline Introduction The selection statement if if.else switch The

More information

Basic Flowchart Symbols and Meaning

Basic Flowchart Symbols and Meaning Page 1 of 7 ConceptDraw Solution Park HOW TO GUIDE Tips from ConceptDraw Experts and Experienced Users Ge ConceptDraw PRO Discover the World of Visual Communication Try It Free Flowcharts are the ideal

More information

FLOW CHART AND PSEUDO CODE

FLOW CHART AND PSEUDO CODE FLOW CHART AND PSEUDO CODE Flowchart A Flowchart is a pictorial representation of an algorithm. The First flowchart is made by John Von Newman in 1945. It is a symbolic diagram of operation sequence, dataflow,

More information

Introduction. C provides two styles of flow control:

Introduction. C provides two styles of flow control: Introduction C provides two styles of flow control: Branching Looping Branching is deciding what actions to take and looping is deciding how many times to take a certain action. Branching constructs: if

More information

بسم اهلل الرمحن الرحيم

بسم اهلل الرمحن الرحيم بسم اهلل الرمحن الرحيم Fundamentals of Programming C Session # 3 By: Saeed Haratian Spring 2016 Outlines Equality and Relational Operators A Simple C Program: Relations Keywords Algorithm Flow Chart Pseudo

More information

Method & Tools for Program Analysis & Design

Method & Tools for Program Analysis & Design Method & Tools for Program Analysis & Design TMB208 Pemrograman Teknik Kredit: 3 (2-3) 1 Programming Logic and Design, Introductory, Fourth Edition 2 1 Programming Methods Based on structures of programming

More information

Engineering program development. Edited by Péter Vass

Engineering program development. Edited by Péter Vass Engineering program development Edited by Péter Vass Introduction Question: Why engineering program development may be useful for a PhD student in Earth Sciences? Counter-argument: In these days a wide

More information

An Introduction to Programming with C++ Sixth Edition. Chapter 7 The Repetition Structure

An Introduction to Programming with C++ Sixth Edition. Chapter 7 The Repetition Structure An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure Objectives Differentiate between a pretest loop and a posttest loop Include a pretest loop in pseudocode Include

More information

Introduction to Flowcharting

Introduction to Flowcharting Introduction to Flowcharting 1 Acknowledgment This tutorial is based upon Appendix C from Starting Out with C++: From Control Structures to Objects (5th Edition) Copyright Tony Gaddis 2007 Published by

More information

Fundamentals of Programming. Lecture 6: Structured Development (part one)

Fundamentals of Programming. Lecture 6: Structured Development (part one) Fundamentals of Programming Lecture 6: Structured Development (part one) Instructor: Fatemeh Zamani f_zamani@ce.sharif.edu edu Sharif University of Technology Computer Engineering Department Outline Algorithms

More information

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm.

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm. CHAPTER 1&2 OBJECTIVES After completing this chapter, you will be able to: Understand the basics and Advantages of an algorithm. Analysis various algorithms. Understand a flowchart. Steps involved in designing

More information

PROGRAM DESIGN TOOLS. Algorithms, Flow Charts, Pseudo codes and Decision Tables. Designed by Parul Khurana, LIECA.

PROGRAM DESIGN TOOLS. Algorithms, Flow Charts, Pseudo codes and Decision Tables. Designed by Parul Khurana, LIECA. PROGRAM DESIGN TOOLS Algorithms, Flow Charts, Pseudo codes and Decision Tables Introduction The various tools collectively referred to as program design tools, that helps in planning the program are:-

More information

Pseudo Code and Flow Charts. Chapter 1 Lesson 2

Pseudo Code and Flow Charts. Chapter 1 Lesson 2 Pseudo Code and Flow Charts Chapter 1 Lesson 2 Pseudocode Using Pseudocode Statements and Flowchart Symbols English-like representation of the logical steps it takes to solve a problem Flowchart Pictorial

More information

INTRODUCTION TO C++ PROGRAM CONTROL. Dept. of Electronic Engineering, NCHU. Original slides are from

INTRODUCTION TO C++ PROGRAM CONTROL. Dept. of Electronic Engineering, NCHU. Original slides are from INTRODUCTION TO C++ PROGRAM CONTROL Original slides are from http://sites.google.com/site/progntut/ Dept. of Electronic Engineering, NCHU Outline 2 Repetition Statement for while do.. while break and continue

More information

Structured Program Development in C

Structured Program Development in C 1 3 Structured Program Development in C 3.2 Algorithms 2 Computing problems All can be solved by executing a series of actions in a specific order Algorithm: procedure in terms of Actions to be executed

More information

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution.

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution. Repetition Structures Introduction to Repetition Structures Chapter 5 Spring 2016, CSUS Chapter 5.1 Introduction to Repetition Structures The Problems with Duplicate Code A repetition structure causes

More information

IDENTIFY WAYS OF REPRESENTING ALGORITHMS.

IDENTIFY WAYS OF REPRESENTING ALGORITHMS. IDENTIFY WAYS OF REPRESENTING ALGORITHMS. OBJECTIVES: Identify ways of representing algorithms: Content Representation of algorithms as Pseudocode or Flowcharts; use of flow chart symbols: input/output

More information

CSC 121 Spring 2017 Howard Rosenthal

CSC 121 Spring 2017 Howard Rosenthal CSC 121 Spring 2017 Howard Rosenthal Agenda To be able to define computer program, algorithm, and highlevel programming language. To be able to list the basic stages involved in writing a computer program.

More information

Loops! Loops! Loops! Lecture 5 COP 3014 Fall September 25, 2017

Loops! Loops! Loops! Lecture 5 COP 3014 Fall September 25, 2017 Loops! Loops! Loops! Lecture 5 COP 3014 Fall 2017 September 25, 2017 Repetition Statements Repetition statements are called loops, and are used to repeat the same code mulitple times in succession. The

More information

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade;

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade; Control Statements Control Statements All programs could be written in terms of only one of three control structures: Sequence Structure Selection Structure Repetition Structure Sequence structure The

More information

Control Structures II. Repetition (Loops)

Control Structures II. Repetition (Loops) Control Structures II Repetition (Loops) Why Is Repetition Needed? How can you solve the following problem: What is the sum of all the numbers from 1 to 100 The answer will be 1 + 2 + 3 + 4 + 5 + 6 + +

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 6 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Spring 2011 These slides are created using Deitel s slides Sharif University of Technology Outlines

More information

LECTURE 5 Control Structures Part 2

LECTURE 5 Control Structures Part 2 LECTURE 5 Control Structures Part 2 REPETITION STATEMENTS Repetition statements are called loops, and are used to repeat the same code multiple times in succession. The number of repetitions is based on

More information

ALGORITHMS AND FLOWCHARTS

ALGORITHMS AND FLOWCHARTS ALGORITHMS AND FLOWCHARTS ALGORITHMS AND FLOWCHARTS A typical programming task can be divided into two phases: Problem solving phase produce an ordered sequence of steps that describe solution of problem

More information

Loops and Files. Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz

Loops and Files. Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Loops and Files Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Chapter Topics o The Increment and Decrement Operators o The while Loop o Shorthand Assignment Operators o The do-while

More information

Quadrilaterals & Transformations Study Guide

Quadrilaterals & Transformations Study Guide s & Transformations Study Guide What do I need to know for the upcoming Summative Assessment? s Classifications and Properties of: o o Trapezoid o Kite o Parallelogram o Rhombus o Rectangle o Square The

More information

REPETITION CONTROL STRUCTURE LOGO

REPETITION CONTROL STRUCTURE LOGO CSC 128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING REPETITION CONTROL STRUCTURE 1 Contents 1 Introduction 2 for loop 3 while loop 4 do while loop 2 Introduction It is used when a statement or a block of

More information

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

Fundamentals of Programming (Python) Control Structures. Sina Sajadmanesh Sharif University of Technology Fall 2017

Fundamentals of Programming (Python) Control Structures. Sina Sajadmanesh Sharif University of Technology Fall 2017 Fundamentals of Programming (Python) Control Structures Sina Sajadmanesh Sharif University of Technology Some slides have been adapted from Python: How to Program 1 st Edition Outline 1. Control Structures

More information

Repetition Algorithms

Repetition Algorithms Repetition Algorithms Repetition Allows a program to execute a set of instructions over and over. The term loop is a synonym for a repetition statement. A Repetition Example Suppose that you have been

More information

PLD Semester Exam Study Guide Dec. 2018

PLD Semester Exam Study Guide Dec. 2018 Covers material from Chapters 1-8. Semester Exam will be built from these questions and answers, though they will be re-ordered and re-numbered and possibly worded slightly differently than on this study

More information

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture 18 Switch Statement (Contd.) And Introduction to

More information

Repetition Structures

Repetition Structures Repetition Structures Chapter 5 Fall 2016, CSUS Introduction to Repetition Structures Chapter 5.1 1 Introduction to Repetition Structures A repetition structure causes a statement or set of statements

More information

Computers Programming Course 6. Iulian Năstac

Computers Programming Course 6. Iulian Năstac Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap

More information

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved. Java How to Program, 9/e Copyright 1992-2012 by Pearson Education, Inc. All Rights Reserved. Copyright 1992-2012 by Pearson Copyright 1992-2012 by Pearson Before writing a program to solve a problem, have

More information

UNDERSTANDING PROBLEMS AND HOW TO SOLVE THEM BY USING COMPUTERS

UNDERSTANDING PROBLEMS AND HOW TO SOLVE THEM BY USING COMPUTERS UNDERSTANDING PROBLEMS AND HOW TO SOLVE THEM BY USING COMPUTERS INTRODUCTION TO PROBLEM SOLVING Introduction to Problem Solving Understanding problems Data processing Writing an algorithm CONTINUE.. Tool

More information

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved. C How to Program, 6/e Before writing a program to solve a particular problem, it s essential to have a thorough understanding of the problem and a carefully planned approach to solving the problem. The

More information

Geometry !!!!! Tri-Folds 3.G.1 - # 1. 4 Mystery Shape 5 Compare & Contrast. 3rd Grade Math. Compare. Name: Date: Contrast

Geometry !!!!! Tri-Folds 3.G.1 - # 1. 4 Mystery Shape 5 Compare & Contrast. 3rd Grade Math. Compare. Name: Date: Contrast 4 Mystery Shape 5 Compare & Contrast 1. Draw and label a shape that has one more side than a triangle. Draw it. 2. Draw and label a shape that has three more sides than a triangle. 3. Draw and label a

More information

Information Science 1

Information Science 1 Information Science 1 Fundamental Programming Constructs (1) Week 11 College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 10 l Flow of control

More information

Information Science 1

Information Science 1 Topics covered Information Science 1 Fundamental Programming Constructs (1) Week 11 Terms and concepts from Week 10 Flow of control and conditional statements Selection structures if statement switch statement

More information

Geometry Workbook WALCH PUBLISHING

Geometry Workbook WALCH PUBLISHING Geometry Workbook WALCH PUBLISHING Table of Contents To the Student..............................vii Unit 1: Lines and Triangles Activity 1 Dimensions............................. 1 Activity 2 Parallel

More information

CS111: PROGRAMMING LANGUAGE1. Lecture 2: Algorithmic Problem Solving

CS111: PROGRAMMING LANGUAGE1. Lecture 2: Algorithmic Problem Solving CS111: PROGRAMMING LANGUAGE1 Lecture 2: Algorithmic Problem Solving Agenda 2 Problem Solving Techniques Pseudocode Algorithm Flow charts Examples How People Solve Problems 3 A Problem exists when what

More information

Chapter 4 Introduction to Control Statements

Chapter 4 Introduction to Control Statements Introduction to Control Statements Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives 2 How do you use the increment and decrement operators? What are the standard math methods?

More information

Week 2. Relational Operators. Block or compound statement. if/else. Branching & Looping. Gaddis: Chapters 4 & 5. CS 5301 Spring 2018.

Week 2. Relational Operators. Block or compound statement. if/else. Branching & Looping. Gaddis: Chapters 4 & 5. CS 5301 Spring 2018. Week 2 Branching & Looping Gaddis: Chapters 4 & 5 CS 5301 Spring 2018 Jill Seaman 1 Relational Operators l relational operators (result is bool): == Equal to (do not use =)!= Not equal to > Greater than

More information

CS 199 Computer Programming. Spring 2018 Lecture 2 Problem Solving

CS 199 Computer Programming. Spring 2018 Lecture 2 Problem Solving CS 199 Computer Programming Spring 2018 Lecture 2 Problem Solving ALGORITHMS AND FLOWCHARTS A typical programming task can be divided into two phases: Problem solving phase produce an ordered sequence

More information

Final Examination Semester 3 / Year 2010

Final Examination Semester 3 / Year 2010 Southern College Kolej Selatan 南方学院 Final Examination Semester 3 / Year 2010 COURSE : PROGRAMMING LOGIC AND DESIGN COURSE CODE : CCIS1003 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM

More information

PLC Papers Created For:

PLC Papers Created For: PLC Papers Created For: Year 10 Topic Practice Papers: Polygons Polygons 1 Grade 4 Look at the shapes below A B C Shape A, B and C are polygons Write down the mathematical name for each of the polygons

More information

C Programming for Engineers Structured Program

C Programming for Engineers Structured Program C Programming for Engineers Structured Program ICEN 360 Spring 2017 Prof. Dola Saha 1 Switch Statement Ø Used to select one of several alternatives Ø useful when the selection is based on the value of

More information

There are algorithms, however, that need to execute statements in some other kind of ordering depending on certain conditions.

There are algorithms, however, that need to execute statements in some other kind of ordering depending on certain conditions. Introduction In the programs that we have dealt with so far, all statements inside the main function were executed in sequence as they appeared, one after the other. This type of sequencing is adequate

More information

LabVIEW Case and Loop Structures ABE 4423/6423 Dr. Filip To Ag and Bio Engineering, Mississippi State University

LabVIEW Case and Loop Structures ABE 4423/6423 Dr. Filip To Ag and Bio Engineering, Mississippi State University LabVIEW Case and Loop Structures ABE 4423/6423 Dr. Filip To Ag and Bio Engineering, Mississippi State University Recap Previous Homework Following Instruction Create a Pressure Conversion VI that takes

More information

CPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points)

CPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points) Name Definition Matching (8 Points) 1. (8 pts) Match the words with their definitions. Choose the best definition for each word. Relational Expression Iteration Counter Count-controlled loop Loop Flow

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba Before writing a program to solve a problem, have a thorough understanding of the problem and a carefully planned approach to solving it. Understand the types of building

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 5 Structured Program Development Department of Computer Engineering How to develop

More information

Software Development. Designing Software

Software Development. Designing Software Software Development Designing Software Modules Modular programming is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such

More information

Chapter 4: Programming with MATLAB

Chapter 4: Programming with MATLAB Chapter 4: Programming with MATLAB Topics Covered: Programming Overview Relational Operators and Logical Variables Logical Operators and Functions Conditional Statements For Loops While Loops Debugging

More information

Fundamentals of Programming

Fundamentals of Programming Fundamentals of Programming Lecture 5 - Structured Program Development Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad How to develop a program? Requirements Problem Analysis

More information

Loops (while and for)

Loops (while and for) Loops (while and for) CSE 1310 Introduction to Computers and Programming Alexandra Stefan 1 Motivation Was there any program we did (class or hw) where you wanted to repeat an action? 2 Motivation Name

More information

Chapter Goals. Contents LOOPS

Chapter Goals. Contents LOOPS CHAPTER 4 LOOPS Slides by Donald W. Smith TechNeTrain.com Final Draft Oct 30, 2011 Chapter Goals To implement while, for, and do loops To hand-trace the execution of a program To become familiar with common

More information

Programming for Engineers Iteration

Programming for Engineers Iteration Programming for Engineers Iteration ICEN 200 Spring 2018 Prof. Dola Saha 1 Data type conversions Grade average example,-./0 class average = 23450-67 893/0298 Grade and number of students can be integers

More information

Key Vocabulary Index. Key Vocabulary Index

Key Vocabulary Index. Key Vocabulary Index Key Vocabulary Index Mathematical terms are best understood when you see them used and defined in context. This index lists where you will find key vocabulary. A full glossary is available in your Record

More information

PDS Lab Section 16 Autumn Tutorial 3. C Programming Constructs

PDS Lab Section 16 Autumn Tutorial 3. C Programming Constructs PDS Lab Section 16 Autumn-2017 Tutorial 3 C Programming Constructs This flowchart shows how to find the roots of a Quadratic equation Ax 2 +Bx+C = 0 Start Input A,B,C x B 2 4AC False x If 0 True B x 2A

More information

Geometry. Geometry is the study of shapes and sizes. The next few pages will review some basic geometry facts. Enjoy the short lesson on geometry.

Geometry. Geometry is the study of shapes and sizes. The next few pages will review some basic geometry facts. Enjoy the short lesson on geometry. Geometry Introduction: We live in a world of shapes and figures. Objects around us have length, width and height. They also occupy space. On the job, many times people make decision about what they know

More information

INTENDED LEARNING OUTCOMES

INTENDED LEARNING OUTCOMES COURSE CODE: GEE 216 COURSE TITLE: COMPUTER AND COMPUTING NUMBER OF UNITS: 3 Units COURSE DURATION: Three hours per week COURSE LECTURER: Engr. Obasi Chukwuemeka INTENDED LEARNING OUTCOMES At the completion

More information

ame Date Class Practice A 11. What is another name for a regular quadrilateral with four right angles?

ame Date Class Practice A 11. What is another name for a regular quadrilateral with four right angles? ame Date Class Practice A Polygons Name each polygon. 1. 2. 3. 4. 5. 6. Tell whether each polygon appears to be regular or not regular. 7. 8. 9. 10. What is another name for a regular triangle? 11. What

More information

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 08: Control Statements Readings: Chapter 6 Control Statements and Their Types A control

More information

Chapter 4 C Program Control

Chapter 4 C Program Control 1 Chapter 4 C Program Control Copyright 2007 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 2 Chapter 4 C Program Control Outline 4.1 Introduction 4.2 The Essentials of Repetition

More information

6. 5 Symmetries of Quadrilaterals

6. 5 Symmetries of Quadrilaterals 2 CC BY fdecomite 6. Symmetries of Quadrilaterals A Develop Understanding Task A line that reflects a figure onto itself is called a line of symmetry. A figure that can be carried onto itself by a rotation

More information

Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7

Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7 Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7 Page 1 6/3/2014 Area and Perimeter of Polygons Area is the number of square units in a flat region. The formulas to

More information

Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7

Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7 Middle School Summer Review Packet for Abbott and Orchard Lake Middle School Grade 7 Page 1 6/3/2014 Area and Perimeter of Polygons Area is the number of square units in a flat region. The formulas to

More information

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.5. for loop and do-while loop

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.5. for loop and do-while loop Superior University Department of Electrical Engineering CS-115 Computing Fundamentals Experiment No.5 for loop and do-while loop Prepared for By: Name: ID: Section: Semester: Total Marks: Obtained Marks:

More information

Name Section: M/W T/TH Number Definition Matching (8 Points)

Name Section: M/W T/TH Number Definition Matching (8 Points) Name Section: M/W T/TH Number Definition Matching (8 Points) 1. (8 pts) Match the words with their definitions. Choose the best definition for each word. Iteration Counter Event Counter Loop Abstract Step

More information

Number and Operation Standard #1. Divide multi- digit numbers; solve real- world and mathematical problems using arithmetic.

Number and Operation Standard #1. Divide multi- digit numbers; solve real- world and mathematical problems using arithmetic. Number and Operation Standard #1 MN Math Standards Vertical Alignment for Grade 5 Demonstrate mastery of multiplication and division basic facts; multiply multi- digit numbers; solve real- world and mathematical

More information

Loops / Repetition Statements

Loops / Repetition Statements Loops / Repetition Statements Repetition statements allow us to execute a statement multiple times Often they are referred to as loops C has three kinds of repetition statements: the while loop the for

More information

Programming in C++ PART 2

Programming in C++ PART 2 Lecture 07-2 Programming in C++ PART 2 By Assistant Professor Dr. Ali Kattan 1 The while Loop and do..while loop In the previous lecture we studied the for Loop in C++. In this lecture we will cover iteration

More information

Unit 1: Area Find the value of the variable(s). If your answer is not an integer, leave it in simplest radical form.

Unit 1: Area Find the value of the variable(s). If your answer is not an integer, leave it in simplest radical form. Name Per Honors Geometry / Algebra II B Midterm Review Packet 018-19 This review packet is a general set of skills that will be assessed on the midterm. This review packet MAY NOT include every possible

More information

If the points on the coordinate plane below are the three vertices of a rectangle;

If the points on the coordinate plane below are the three vertices of a rectangle; Polygons in the Coordinate Plane - Step-by-Step Lesson If the points on the coordinate plane below are the three vertices of a rectangle; What are the coordinates of the fourth vertex? How do you know?

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #01 Introduction: The Process of Programming

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #01 Introduction: The Process of Programming Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #01 Introduction: The Process of Programming Welcome to the introductory programming course on NPTEL MOOCs. The

More information

Control Structures (Deitel chapter 4,5)

Control Structures (Deitel chapter 4,5) Control Structures (Deitel chapter 4,5) 1 2 Plan Control Structures ifsingle-selection Statement if else Selection Statement while Repetition Statement for Repetition Statement do while Repetition Statement

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All for repetition statement do while repetition statement switch multiple-selection statement break statement continue statement Logical

More information

Computer Programming. Basic Control Flow - Loops. Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons

Computer Programming. Basic Control Flow - Loops. Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons Computer Programming Basic Control Flow - Loops Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons Objectives To learn about the three types of loops: while for do To avoid infinite

More information

Unit-II Programming and Problem Solving (BE1/4 CSE-2)

Unit-II Programming and Problem Solving (BE1/4 CSE-2) Unit-II Programming and Problem Solving (BE1/4 CSE-2) Problem Solving: Algorithm: It is a part of the plan for the computer program. An algorithm is an effective procedure for solving a problem in a finite

More information

Name Section: M/W T/TH Number Definition Matching (6 Points)

Name Section: M/W T/TH Number Definition Matching (6 Points) Name Section: M/W T/TH Number Definition Matching (6 Points) 1. (6 pts) Match the words with their definitions. Choose the best definition for each word. Event Counter Iteration Counter Loop Flow of Control

More information

IT 1033: Fundamentals of Programming Loops

IT 1033: Fundamentals of Programming Loops IT 1033: Fundamentals of Programming Loops Budditha Hettige Department of Computer Science Repetitions: Loops A loop is a sequence of instruction s that is continually repeated until a certain condition

More information

Q3 Exam Review Date: Per:

Q3 Exam Review Date: Per: Geometry Name: Q3 Exam Review Date: Per: Show all your work. Box or circle your final answer. When appropriate, write your answers in simplest radical form, as a simplified improper fraction, AND as a

More information

Fractions. 7th Grade Math. Review of 6th Grade. Slide 1 / 306 Slide 2 / 306. Slide 4 / 306. Slide 3 / 306. Slide 5 / 306.

Fractions. 7th Grade Math. Review of 6th Grade. Slide 1 / 306 Slide 2 / 306. Slide 4 / 306. Slide 3 / 306. Slide 5 / 306. Slide 1 / 06 Slide 2 / 06 7th Grade Math Review of 6th Grade 2015-01-14 www.njctl.org Slide / 06 Table of Contents Click on the topic to go to that section Slide 4 / 06 Fractions Decimal Computation Statistics

More information

Microsoft Visual Basic 2005: Reloaded

Microsoft Visual Basic 2005: Reloaded Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 4 Making Decisions in a Program Objectives After studying this chapter, you should be able to: Include the selection structure in pseudocode

More information

TABLE OF CONTENTS 2 CHAPTER 1 3 CHAPTER 2 4 CHAPTER 3. Algorithm Design & Problem Solving. Programming. Databases

TABLE OF CONTENTS 2 CHAPTER 1 3 CHAPTER 2 4 CHAPTER 3. Algorithm Design & Problem Solving. Programming. Databases 2 CHAPTER 1 Algorithm Design & Problem Solving 3 CHAPTER 2 Programming 4 CHAPTER 3 Databases TABLE OF CONTENTS 1. ALGORITHM DESIGN & PROBLEM-SOLVING 1.1 Problem-solving & Design Every computer system is

More information

Mathematics Curriculum Grade 3

Mathematics Curriculum Grade 3 3A.Numbers and Operations Demonstrate an understanding of numbers, ways of representing numbers, relationships among numbers and number systems 3A.1 3A.2 3A.3 Apply place-value concepts and numeration

More information

Benjamin Adlard School 2015/16 Maths medium term plan: Autumn term Year 6

Benjamin Adlard School 2015/16 Maths medium term plan: Autumn term Year 6 Benjamin Adlard School 2015/16 Maths medium term plan: Autumn term Year 6 Number - Number and : Order and compare decimals with up to 3 decimal places, and determine the value of each digit, and. Multiply

More information

Programming Language. Control Structures: Repetition (while) Eng. Anis Nazer Second Semester

Programming Language. Control Structures: Repetition (while) Eng. Anis Nazer Second Semester Programming Language Control Structures: Repetition (while) Eng. Anis Nazer Second Semester 2017-2018 Repetition statements Control statements change the order which statements are executed Selection :

More information

Internet & World Wide Web How to Program, 5/e by Pearson Education, Inc. All Rights Reserved.

Internet & World Wide Web How to Program, 5/e by Pearson Education, Inc. All Rights Reserved. Internet & World Wide Web How to Program, 5/e Sequential execution Execute statements in the order they appear in the code Transfer of control Changing the order in which statements execute All scripts

More information

Flow Chart & Algorithms

Flow Chart & Algorithms Flow Chart Algorithms Planning Your Code Page 1 Page 4 See Appendix A, for Licensing Attribution information by-nc-sa-3.0 https://creativecommons.org/licenses/by-nc-sa/3.0/ https://creativecommons.org/faq/#what-does-some-rights-reserved-mean

More information

Chapter 1 INTRODUCTION TO COMPUTER AND PROGRAMMING

Chapter 1 INTRODUCTION TO COMPUTER AND PROGRAMMING Chapter 1 INTRODUCTION TO COMPUTER AND PROGRAMMING Computer programming BTI 10202 Compiled by SIA CHEE KIONG DEPARTMENT OF MATERIAL AND DESIGN ENGINEERING FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING

More information