Chapter (3) - Looping Questions.

Slides:



Advertisements
Similar presentations
Repetition Statements Perform the same task repeatedly Allow the computer to do the tedious, boring things.
Advertisements

Looping Structures: Do Loops
Chapter 6: The Repetition Structure
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
CHAPTER 5: Repetition Control Structure. Objectives  To develop algorithms that use DOWHILE and REPEAT.. UNTIL structures  Introduce a pseudocode for.
Iteration (Looping Constructs in VB) Iteration: Groups of statements which are repeatedly executed until a certain test is satisfied Carrying out Iteration.
Iteration (Looping Constructs in VB) Iteration: Groups of statements which are repeatedly executed until a certain test is satisfied Carrying out Iteration.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 9 Car Payment Calculator Application Introducing the Do While...Loop and Do Until...Loop.
Chapter 5 new The Do…Loop Statement
Repetition Statements Repeating an Action A specified number of times While a Condition is True Until a Condition is True.
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
Chapter 5 Control Structures: Loops 5.1 The while Loop The while loop is probably the most frequently used loop construct. The while loop is a conditional.
For Loops (ProjFor1, ProjFor2, ProjFor3, ProjFor4, textbox, textbox1) Please use speaker notes for additional information!
1 Week 6 The Repetition Structure. 2 The Repetition Structure (Looping) Lesson A Objectives After completing this lesson, you will be able to:  Code.
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
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.
Lecture 4: Calculating by Iterating. The while Repetition Statement Repetition structure Programmer specifies an action to be repeated while some condition.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Flow Control (for) Outline 4.1Introduction 4.2The.
Repetition Structures Repetition Structures allow you to write programs that will repeat program steps multiple times. –Also called Loops –Counter controlled.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
Counter-Controlled Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 5A Repetition (Concepts)
JavaScript, Fourth Edition
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
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.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Chapter 6 Looping Structures. Do…LoopDo…Loop Statement Can operate statements repetitively Do intx=intx + 1 Loop While intx < 10 –The Loop While operates.
CECS 5020 Computers in Education Visual Basic Variables and Constants.
For…Next and Do...While Loops! Happy St. Patrick’s Day!
© 2006 Lawrenceville Press Slide 1 Chapter 6 The Post-Test Do…Loop Statement  Loop structure that executes a set of statements as long as a condition.
Higher Computing Software Development -So Far- 5/10/10.
Controlling Program Flow with Looping Structures
Topic: Control Statements. Recap of Sequence Control Structure Write a program that accepts the basic salary and allowance amount for an employee and.
REPETITION MTS3033 OBJECT ORIENTED PROGRAMMING 1.
Chapter 7: The Repetition Structure Introduction to Programming with C++ Fourth Edition.
Fourth Quarter.  Involves loops or cycles ◦ Loops: means that a process may be repeated as long as certain condition remains true or remains false. ◦
C Language 1 Program Looping. C Language2 Topics Program looping Program looping Relational operators / expressions Relational operators / expressions.
Chapter 6 Controlling Program Flow with Looping Structures.
© 2010 Lawrenceville Press Slide 1 Chapter 5 The Do…Loop Statement  Loop structure that executes a set of statements as long as a condition is true. 
UCT Department of Computer Science Computer Science 1015F Iteration
Visual Basic Fundamental Concepts
Egyptian Language School Computer Department
Chapter 9 Repetition.
IE 8580 Module 4: DIY Monte Carlo Simulation
Tutorial 12 Working with Arrays, Loops, and Conditional Statements
Visual Basic 6 (VB6) Data Types, And Operators
Tutorial 10 – Class Average Application Introducing the Do…Loop While and Do…Loop Until Repetition Statements Outline Test-Driving the Class Average.
Lecture 7: Repeating a Known Number of Times
3rd prep. – 2nd Term MOE Book Questions.
Chapter 2.2 Control Structures (Iteration)
3rd prep. – 2nd Term MOE Book Questions.
Starter Write a program that asks the user if it is raining today.
Chapter 6 – Repetition 6.1 Do Loops 6.2 For...Next Loops
Chapter 5 Structures.
Chapter 5 Repetition.
Chapter 4 LOOPS © Bobby Hoggard, Department of Computer Science, East Carolina University / These slides may not be used or duplicated without permission.
Visual Basic..
Chapter 5 The Do…Loop Statement
حلقات التكرار.
Fundamentals of visual basic
A LESSON IN LOOPING What is a loop?
Repetition Statements (Loops) - 2
Final Revision sheet- term2
Final Revision sheet- term2
Presentation transcript:

Chapter (3) - Looping Questions

click Button1 Variable , Integer M 1 3 1 4 MsgBox(M)

To print the odd numbers from 5 to 9 But_Repeat click Dim (For … Next) Statement Me.Label1.text = Me.Label1.Text & m & vbCrLf Concatenate or append strings together MsgBox (m)

To Print the multiplication table of table 3 from 1 to 12 in separate lines inside textbox control. True True False True True

5 11 7 7

Dim n , Product As Integer Dim n , Product As String For n = 1 To 10 Step 1 For n = 1 To 10 Step -1 Product = 9 * n Product = 9 + n Next str Next n

Product Str Next m

I 1 B C TO Create new line between variables To print the numbers from 1 to B and increased by C in separate lines inside textbox1 I 1 B C TO Create new line between variables

Comparison between Looping Statements For …Next Statement Do …. While Statement It is one of the limited loop statements used when we want to repeat a code for specific number of time . It needs numeric variable (integer or decimal) to work as a counter with start value , end value and add or increment value . The statement 'Do while ... loop' is used to repeat a specific code for a several times of an unknown end, but based on a specific condition, so they are useful if you do not know the number of iterations emphatically. The repetitive code will be implemented (executed) as long as the counter variable is less than or equal the end value .The loop stops when the value of the counter exceeds the last value. The repetitive code will be implemented (executed) as long as the conditional expression is true. If the condition is not met for any reason, we get out of the iterative loop, and implement the code after the Loop if it exists. General syntax for this statement For Variable = Start To End Step Add Value Repetitive Code Next [Variable] Do While Conditional Expression Repetitive Code Loop

To increase the counter variable I by 2 Do … While To increase the counter variable I by 2 To print the odd or even no.`s from 1 to the entered no. Control Method property

To receive the value entered by the user in textbox1 and assign it to the variable N in computer memory. Do … While Statement The conditional expression (I <= N) is true TextBox1 N