Higher Computing Using Loops.

Slides:



Advertisements
Similar presentations
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
Advertisements

Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
ABNIAC The following slide presentation is to acquaint the student with ABNIAC. The version used for presentation is the Java version, which can be found.
Do/Loops A loop repeats a series of instructions. An iteration is a single execution of the statement(s) in the loop. Used when the exact number of iterations.
True BASIC Ch. 6 Practice Questions. What is the output? PRINT X LET X = -1 PRINT X FOR X = 4 TO 5 STEP 2 PRINT X NEXT X PRINT X END.
BACS 287 Programming Logic 3. BACS 287 Iteration Constructs Iteration constructs are used when you want to execute a segment of code several times. In.
Iteration (Looping Constructs in VB) Iteration: Groups of statements which are repeatedly executed until a certain test is satisfied Carrying out Iteration.
Do Loops A Do..Loop terminates based on a condition that is specified Execution of a Do..Loop continues while a condition is True or until a condition.
Handling Errors Introduction to Computing Science and Programming I.
BACS 287 Programming Fundamentals 4. BACS 287 Programming Fundamentals This lecture introduces the following iteration control structure topics: – Do.
Repeating Program Instructions Chapter Microsoft Visual Basic.NET: Reloaded 1.
PRINCIPLES OF PROGRAMMING Revision. A Computer  A useful tool for solving a great variety of problems.  To make a computer do anything (i.e. solve.
Last Week Doctests Lists List methods Nested Lists Aliasing.
ENGR 112 Decision Structures.
Mastery Objective: Students will understand how to use while loops in computer programming.
ME 142 Engineering Computation I Loops. Key Concepts Looping Basics For… Next Statement Do… Loop Statement For Each… Next Statement.
1 Week 6 The Repetition Structure. 2 The Repetition Structure (Looping) Lesson A Objectives After completing this lesson, you will be able to:  Code.
Compunet Corporation1 Programming with Visual Basic.NET While, Do and For – Next Loops Week 5 Tariq Ibn Aziz.
Tutorial 6 The Repetition Structure
Visual Basic.net Loops. Used to do multiple executions of the same block of code Do while loops Do until loops For next loops.
Coding Design Tools Rachel Gauci. What are Coding Design Tools? IPO charts (Input Process Output) Input- Make a list of what data is required (this generally.
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.
1 Chapter 9. To familiarize you with  Simple PERFORM  How PERFORM statements are used for iteration  Options available with PERFORM 2.
CW-V1 SDD 0901 Principals of Software Design and Development Loops Starter: Water JugsWater Jugs.
Looping Structures Do Loops, For Next Do...Loop While structures check the condition after executing the code and repeat a code block until the test.
Agenda Perform Quiz #1 (20 minutes) Loops –Introduction / Purpose –while loops Structure / Examples involving a while loop –do/while loops Structure /
Tutorial 6: The Repetition Structure1 Tutorial 6 The Repetition Structure.
Controlling Program Flow with Looping Structures
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 14 Do It, Then Ask Permission.
National Diploma Unit 4 Introduction to Software Development Data Structures – Loops and selection.
Looping Structures. A B dialog box that pops up and prompts the user for input Text area that pops up and prompts the user for to wait while it gets.
Microsoft® Small Basic Conditions and Loops Estimated time to complete this lesson: 2 hours.
1 VB-04-Control Structures 16 March 2016 Visual Basic Control Structures - Selection.
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
CSC111 Quick Revision.
while Repetition Structure
Tutorial 10 – Class Average Application Introducing the Do…Loop While and Do…Loop Until Repetition Statements Outline Test-Driving the Class Average.
CSCI 3327 Visual Basic Chapter 4: Control Statements in Visual Basic (Part 2B) UTPA – Fall 2011 Part of the slides is from Dr. John Abraham’s previous.
ALGORITHMS & FLOWCHARTING II
3rd prep. – 2nd Term MOE Book Questions.
Do it now activity Green pen activity in books.
Repeating Program Instructions
Starter Write a program that asks the user if it is raining today.
Microsoft Visual Basic 2005: Reloaded Second Edition
Standard Algorithms Input validation Finding the minimum
Repetition and Loops while do while for continue break
More Loops.
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Loops A portion of a program that repeats a statement or a group of statements is called a loop. The statement or group of statements to be repeated is.
Chapter (3) - Looping Questions.
Iteration: Beyond the Basic PERFORM
Iteration: Beyond the Basic PERFORM
Introduction to TouchDevelop
LOOPS BY: LAUREN & ROMEO.
CIS 16 Application Development Programming with Visual Basic
Design and Implementation
Problem Solving and Control Statements
DO NOT OPEN YOUR BINDER UNTIL INSTRUCTED
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
A LESSON IN LOOPING What is a loop?
ICT Gaming Lesson 2.
Introduction to Computer Science
Little Man Computer (continued).
LOOPS The loop is the control structure we use to specify that a statement or group of statements is to be repeatedly executed. Java provides three kinds.
GCSE Computing:: While Loops
Week 7: Computer Tools for Problem Solving and Critical Thinking
What Are Performance Counters?
How to allow the program to know when to stop a loop.
Iteration – While Loops
Presentation transcript:

Higher Computing Using Loops

1. Using For…Next Loop For counter = 1 to 100 Print text$ Next counter

2. Using For…Next Loop For counter = 2 to 20 step 2 Print counter Next counter

4. Using Do…Loop Until DO (Start loop) Display message to ask for a number Get number from keyboard If number <> 0 then Print number End if Loop Until number = 0

5. Using Do…Loop Until Set password to STOP DO (Start loop) Get guess from user If guess is not equal to password then error message End if Loop Until guess = password

10. Using DO WHILE Set password to STOP Get guess from user Do While guess <> password Error message Display message to ask for another guess loop

The FOR ………NEXT loop is a fixed loop ie the number of times that the instructions are executed is fixed at the start of the loop. The DO………LOOP UNTIL and the DO WHILE loop are conditional loops – the number of times that the instructions are executed depends on a condition being met. The DO………LOOP UNTIL tests the condition at the end The DO WHILE tests the condition at the start