Repetition and Loops while do while for continue break

Slides:



Advertisements
Similar presentations
What is the sum of the following infinite series 1+x+x2+x3+…xn… where 0
Advertisements

CHAPTER 5: Repetition Control Structure. Objectives  To develop algorithms that use DOWHILE and REPEAT.. UNTIL structures  Introduce a pseudocode for.
REPETITION (loops or iteration) Schneider: Sec. 6.1 & 6.3.
Iteration Statements Lather Rinse Repeat. Three Iteration Statements For Each For Next While.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 3, Lecture 2.
1 10/20/08CS150 Introduction to Computer Science 1 do/while and Nested Loops Section 5.5 & 5.11.
Iteration This week we will learn how to use iteration in C++ Iteration is the repetition of a statement or block of statements in a program. C++ has three.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 - Functions Outline 3.12Recursion 3.13Example Using Recursion: The Fibonacci Series 3.14Recursion.
Basic Building Blocks of Programming. Variables and Assignment Think of a variable as an empty container Assignment symbol (=) means putting a value into.
EGR 2261 Unit 5 Control Structures II: Repetition  Read Malik, Chapter 5.  Homework #5 and Lab #5 due next week.  Quiz next week.
Study Guide For Test Chapter 5, 6,& 7 Test is Friday, May 15th.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
Java Programming: From Problem Analysis to Program Design, Second Edition1 Lecture 4 Objectives  Learn about repetition (looping) control structures.
While Loops CMSC 201. Overview Today we will learn about: Looping Structures While loops.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Functions (Recursion) Outline 5.13Recursion 5.14Example.
Lecture 4: Calculating by Iterating. The while Repetition Statement Repetition structure Programmer specifies an action to be repeated while some condition.
Chapter 9.5 ALTERNATING SERIES.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Repetition. Loops Allows the same set of instructions to be used over and over again Starts with the keyword loop and ends with end loop. This will create.
COP 3275 – Iteration and loops Instructor: Diego Rivera-Gutierrez.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 11.
COMP Loop Statements Yi Hong May 21, 2015.
Why Repetition? Read 8 real numbers and compute their average REAL X1, X2, X3, X4, X5, X6, X7, X8 REAL SUM, AVG READ *, X1, X2, X3, X4, X5, X6, X7, X8.
CPSC 233 Tutorial 5 February 2 th /3 th, Java Loop Statements A portion of a program that repeats a statement or a group of statements is called.
CONTENTS Loop Statements Parts of a loop Types of Loops Nested Loops
BIL 104E Introduction to Scientific and Engineering Computing Lecture 6.
Chapter 6: Loops.
Chapter 4 Repetition Statements (loops)
while Repetition Structure
Repetition Control Structure in C++ Program
Chapter 5: Control Structures II
Sequences and Series 9.1.
Chapter 3: Decisions and Loops
Lecture 7: Repeating a Known Number of Times
Chapter 5: Control Structures II
Chapter 5: Repetition Structures
CiS 260: App Dev I Chapter 4: Control Structures II.
Chapter 2.2 Control Structures (Iteration)
Introducing Do While & Do Until Loops & Repetition Statements
Chapter 4 Loops Case Studies
Iterations Programming Condition Controlled Loops (WHILE Loop)
And now for something completely different . . .
Chapter 4 Control structures and Loops
Looping and Repetition
Control Structure Senior Lecturer
Programming Fundamentals Lecture #6 Program Control
Outline Altering flow of control Boolean expressions
Conditional Construct
Chapter 6: Repetition Structures
Chapter 5: Repetition Structures
Chapter 6 Decision Making and Looping
The University of Texas – Pan American
Higher Computing Using Loops.
Iteration: Beyond the Basic PERFORM
Iteration: Beyond the Basic PERFORM
More Looping Structures
Chapter 2.2 Control Structures (Iteration)
CMPT 102 Introduction to Scientific Computer Programming
Computer Science Core Concepts
A LESSON IN LOOPING What is a loop?
Program Flow.
CS149D Elements of Computer Science
Repetition Statements (Loops) - 2
The structure of programming
Lec 6 Loop Statements Introduction to Computer Programming
More Looping Structures
Thinking procedurally
Iteration – While Loops
REPETITION Why Repetition?
Looping and Repetition
Presentation transcript:

Repetition and Loops while do while for continue break

Most programs involve repetition or looping. A loop is a group of instructions the computer executes repeatedly while some loop-continuation condition remains true.

Finding factorial number

Nested loops

infinite loops (loops that do not finish executing)

Factors of a number

Finding power of a number

Finding fibonacci series

Homework Write a program that finds whether a given integer is an Armstrong number: Such as: 153 = 1*1*1 + 5*5*5 + 3*3*3 // 153 is an Armstrong number. 12 is not equal to 1*1*1+2*2*2 // 12 is not an Armstrong number. The program will read the integer from the user and find the result Send the “my_program_e145197.c” file to my email address (tanseldoker@yahoo.com.tr) Until Sunday midnight