Input a number and print its table, using FOR loop.

Slides:



Advertisements
Similar presentations
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 10: Recursion Problem Solving & Program Design in C Sixth Edition.
Advertisements

LOOPS Loops are lines of code that can be run more than one time. Each time is called an iteration and in for loops there is also an index that is changing.
How SAS implements structured programming constructs
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
Case study 1: Calculate the approximation of Pi
Are You Smarter Than a 5 th Grader? 1,000,000 Input tables 1 Input tables 2 Double Digit Multiplication 1 Double digit multiplication 2 Multiplying.
11.3 Function Prototypes A Function Prototype contains the function’s return type, name and parameter list Writing the function prototype is “declaring”
Structured programming
CHAPTER 2 ANALYSIS OF ALGORITHMS Part 2. 2 Running time of Basic operations Basic operations do not depend on the size of input, their running time is.
1 times table 2 times table 3 times table 4 times table 5 times table
Computer Science 111 Fundamentals of Programming I Iteration with the for Loop.
1.7 Arrays academy.zariba.com 1. Lecture Content 1.Basic Operations with Arrays 2.Console Input & Output of Arrays 3.Iterating Over Arrays 4.List 5.Cloning.
Computer Science: A Structured Programming Approach Using C1 6-9 Recursion In general, programmers use two approaches to writing repetitive algorithms.
Algorithmic Recursion. Recursion Alongside the algorithm, recursion is one of the most important and fundamental concepts in computer science as well.
While Loops CMSC 201. Overview Today we will learn about: Looping Structures While loops.
Chapter 1. Objectives To provide examples of computer science in the real world To provide an overview of common problem- solving strategies To introduce.
Lecture 3.4: Recursive Algorithms CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Zeph Grunschlag.
Computer Science 111 Fundamentals of Programming I Making Choices with if Statements.
Lecture 4: Calculating by Iterating. The while Repetition Statement Repetition structure Programmer specifies an action to be repeated while some condition.
Basic Control Structures
CSCI-100 Introduction to Computing
Running Totals CSIS 1595: Fundamentals of Programming and Problem Solving 1.
WHAT IS THE VALUE OF X? x = 0 for value in [3, 41, 12, 9, 74, 15] : if value < 10 : x = x + value print x.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 5 Repetition.
5 While-Statements © 2010 David A Watt, University of Glasgow Accelerated Programming 2 Part I: Python Programming.
Count Controlled Loops (Nested) Ain’t no sunshine when she’s gone …
$100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300.
CS 162 Intro to Programming II Insertion Sort 1. Assume the initial sequence a[0] a[1] … a[k] is already sorted k = 0 when the algorithm starts Insert.
Tables Learning Support
Equations Inequalities = > 3 5(8) - 4 Numerical
Polya’s 4-step Process 1.Understand the problem 2.Devise a plan 3.Carry out the plan 4.Look back, review results.
Loops CMSC 201. Overview Today we will learn about: Looping Structures While loops For Loops.
ADD To get next term Have a common difference Arithmetic Sequences Geometric Sequences MULTIPLY to get next term Have a common ratio.
Keywords: Range Trace table Testing List Index Activities: To create a trace table for a small piece of code using a set of data. Create a trace table.
For Loop GCSE Computer Science – Python. For Loop The for loop iterates over the items in a sequence, which can be a string or a list (we will discuss.
Iteration: FOR, DO, LOOP Loop Damian Gordon. FOR Loop The FOR loop does the same thing as a WHILE loop but is easier if you are using the loop to do a.
Grade 7 Chapter 4 Functions and Linear Equations.
Lecture 3.4: Recursive Algorithms CS 250, Discrete Structures, Fall 2015 Nitesh Saxena Adopted from previous lectures by Zeph Grunschlag.
More about Iteration Victor Norman CS104. Reading Quiz.
Trace Tables In today’s lesson we will look at:
Program design Program Design Process has 2 phases:
Flowchart Symbols Terminal Process Input/ Output Decision
Python Loops and Iteration
Think What will be the output?
Times Tables.
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Exponential Functions
Notes Over 2.1 Function {- 3, - 1, 1, 2 } { 0, 2, 5 }
إستراتيجيات ونماذج التقويم
Unary Operators ++ and --
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Count Controlled Loops (Nested)
C Graphing Functions.
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) What is printed?
Algorithms Take a look at the worksheet. What do we already know, and what will we have to learn in this term?
Some Common Issues: Iteration
Computer Science Core Concepts
Python programming exercise
Equations and functions
Print the following triangle, using nested loops
Problem Input a number and print its table using while loop. In the end print Good Bye only once.
x/÷ Numbers Year 3-4 – Multiply and divide a multiple of 10
Control Operations Basic operations are input, output, arithmetic, etc. Control operations allow for sequencing other operations Choose between several.
For Loops Pages
3 times tables.
6 times tables.
Basic 9 Mr. Husch.
Create Folder Unit 5 (All work for this unit to be stored here)
COMPUTING.
Arrays: Iteration Working through an array algorithmically.
Presentation transcript:

Input a number and print its table, using FOR loop. Iterative Statments- Example Input a number and print its table, using FOR loop.

Algorithm Dry Run Program/Code a=int(input(“Enter a number”)) Step 1:- Input first number in variable a 4 for i in range(1,11): Step 2:- Iterate it 10 times with for loop having value of i starting from 1 to 10 1 2 … 10 b=a*i 4*1 4*2 4*.. 4*10 Step 3:- multiply a*i in b print(b) 8 Step 4:- print b 4 … 40 Print goodbye print(“Goodbye”)

TAG Question Number Expectations Grade C example and 13 Grade B example, 13 and15 Grade A example, 13,15 and 17 Grade A* example, 13,15,17 & evaluation

Print 10 iterations of Fibonacci sequence. 0 1 1 2 3 5 8 13 21 34 Problem Print 10 iterations of Fibonacci sequence. 0 1 1 2 3 5 8 13 21 34