While loops while ( ) { } -------------------------- while ( ) ;

Slides:



Advertisements
Similar presentations
PSEUDOCODE & FLOW CHART
Advertisements

ECE Application Programming
Made by: Second Grade On the head side One coin that equals On the tails side Give the value of…
Topic Map Topic 5 Lesson 1 = Dime, Nickel, Penny
Identify and state the value of a penny, nickel, dime, quarter Level 1 CLICK HERE TO START LEVEL 1.
CS 112 Intro to Computer Science II Sami Rollins Fall 2006.
In Class Exercises. TV  Think about your television as an object.  You send messages to it using the remote control. What messages can you send?  What.
What is your strategy for counting money?
2nd grade Math Lesson 2.MD.8. Solve word problems involving dollar bills, quarters, dimes, nickels, and pennies, using $ and ¢ symbols appropriately.
3nd Grade Mathematics Ms. Coleman
I wonder who has more money…. 1 dollar, 3 nickels, 5 dimes 6 dimes, 3 pennies, 5 quarters 8 pennies, 6 nickels, 3 dimes 2 half dollars, 5 pennies, 8 nickels.
C HANGES (P ROG 600 – 58 T ) AP Computer Science 2010 By: Chia-Hsuan Wu.
Tisha Nygren Tisha Nygren Kennesaw State University MKN1H – Students will identify coins by name and value (penny, nickel, dime, and quarter).
We use Math everyday…. to build to build a house
Math Review Show each amount using the fewest number of coins. 98¢ pennies nickels dimes quarters 1.
Working with Money Grade 3 Math Lesson Mrs. Frederico.
Money By: Rachel Morello Teacher Page Click here!
Money 2 nd Grade Mathematics Miss Marouchoc NEXT.
Money Counting By: Aleela Bovell 2 nd Grade Math LETS BEGIN!
Money I. Objectives To be able to recognize U.S. coins & the dollar To know the value of each coin & dollar To know how coins are related to each other.
Counting Money Pennies, Nickels, & Dimes Created by Mrs. Miller Math SOL K.7 & 1.10.
Penny Nickel Dime Penny Nickel Dime Quarter Half Dollar.
MONEY (COIN) REVIEW By: Jessica Lunceford START. Click the coins for a sing-along review. Once the song is finished return to this page. Click here to.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Who uses it?. We all use money to buy what we need to function in our world. Money Vocabulary Bills Dollars Coins Sliver Dollar Half Dollar Fifty Cent.
Counting Coins. The Basics Quarter 25 cents Dime 10 cents.
MONEY! Pick the correct coin! Click here to get started!!
Touch Money Jane Hancock.
 M2N1. Students will use multiple representations of numbers to connect symbols to quantities  c. Use money as a medium of exchange. Make change and.
British and American Money
Canadian Money. Coins Penny 1 cent 1¢ Nickel 5 cents 5¢
Let’s Learn About Money!
Name the United States Coins Count the Pennies 10 ¢
Coin Problems.
MATH AND MONEY.
 Objective: Students will be able to familiarize themselves with the coin features as well as write the amount of each coin in dollars and cents.
Program Design BUILDING A HOUSE. Steps to Designing a Program 1. Define the Output 2. Develop the logic to get that output 3. Write the program.
Adding and Subtracting Money! Click on the dollar sign to begin!
Coins A small piece of metal, usually flat and circular, authorized by a government for use as money.
The Importance of Counting Coins. Coins in everyday life  How important is being able to count coins?  What are coins used for?  When and how often.
Counting Quarters, Dimes, Nickels, and Pennies Click here to begin Click here to begin.
1st Grade Created by Jennifer Beach
Math Methods. Coin recognition Values of coins Using the values of coins Counting sets of coins (including comparing two sets) Equivalent collections.
Money Students will first learn about each coin. Then they will have to draw lines to match the front of each coin to the back. Last the students will.
1 State machine by nature are ideally suited to track state and detect specific sequence of events For example, we may design specific machines to track.
Money Counting change! Counting change! © Math As A Second Language All Rights Reserved 2.MD#8 next.
Money, Money, Money, Money!!!!!!! Counting money is as easy as 1, 2, 3.
2 nd Grade Math Counting Money by Annette Burchett.
JAVA PROGRAMMING Control Flow. Jeroo: Finish Activities 1-7 Finish InputTest program w/changes.
Money – Change Combinations &MathLine. Start with each ring representing a penny Money – Change.
Today we are going to talk about coins and their value! We will be finding out the value of pennies, nickels, dimes and quarters! Standards: MAFS.1.MD.2.a:
$ Money $ $ Money $ $ Money $.
 Real numbers representation - Floating Point Notation  First C Program  Variables Declaration  Data Types in C ◦ char, short, int, long, float, double,
HOW CAN I CONVERT MONEY? MCC.4.MD.1 Money. Conversions ____ pennies = 1 nickel ____ nickels = 1 dime ____ dimes = 1 dollar ____ quarters = 1 dollar.
Algorithms 09/04/13. Algorithm Step-by-step process for solving a problem. Often described in pseudocode language. Unambiguous, Executable and Terminating.
Flowchart Symbols Terminal Process Input/ Output Decision
ECE Application Programming
ECE Application Programming
Money    By: Kaitlin and Chloe.
Begin at 5. Count by 5s to 100. Begin at 30. Count by 10s to 150.
k-2 Lesson d: kids as coins Coin Signs
Counting Coins for 1st grade
Money Concept Assessment Bank
ECE Application Programming
$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
Structured Program Design
Advanced Learner Coin Pictures
Name the United States Coins
EECE.2160 ECE Application Programming
Money Math Review.
Presentation transcript:

while loops while ( ) { } while ( ) ;

while loops - example x = 7; while ( x < 10 ) { printf("%d",x); x++; } OUTPUT:

while loops - example x = 7; while ( x < 3 ) { printf("%d",x); x++; } OUTPUT:

do-while loops do { statements } while ( )

do-while loops - example x = 7; do { printf("%d",x); x++; } while ( x < 10 ) OUTPUT:

do-while loops - example x = 7; do { printf("%d",x); x++; } while ( x < 3 ) OUTPUT:

comparison while vs do-while x = 7; do { printf("%d",x); x++; } while ( x < 10 ) OUTPUT: x = 7; while ( x < 10 ) { printf("%d",x); x++; } OUTPUT:

comparison while vs do-while x = 7; do { printf("%d",x); x++; } while ( x < 3 ) OUTPUT: x = 7; while ( x < 3 ) { printf("%d",x); x++; } OUTPUT:

Ideal use for while: when you don't know how many times to loop OUTPUT:

Change problem - while example Statement of problem: Given any amount of change under $2.00, determine and print out the minimum number of coins required to make that amount of change. Available coins are Halves, Quarters, Dimes, Nickels, and Pennies.

Flowcharting Process Predefined Process Preparation Decision User Input Input/Output Display Output Terminator Connector Connector (off page)

Flowcharting - Sample myAmt = amount myAmt < 0.50 scanf amount Start printf nHalves Given some amount of money, amount, how many half dollars would be returned? myAmt = myAmt nHalves = nHalves + 1 nHalves = 0 Finish

Expand to all coins - page 1 myAmt < 0.50 myAmt = myAmt nH = nH+ 1 myAmt = amount scanf amount Start nH = 0 A A B

myAmt < 0.25 myAmt = myAmt nQ = nQ + 1 nQ = 0 C myAmt < 0.10 myAmt = myAmt nD = nD + 1 nD = 0 myAmt < 0.05 myAmt = myAmt nN = nN + 1 nN = 0 C myAmt < 0.01 myAmt = myAmt nP = nP + 1 nP = 0 B D

D printf nH,nQ,nD,nN,nP Finish

Expand to all coins - page 1 myAmt < vH myAmt = myAmt - vH nH = nH+ 1 myAmt = amount scanf amount Start nH = 0; vH=0.50 A A B

myAmt < vQ myAmt = myAmt - vQ nQ = nQ + 1 nQ = 0; vQ=0.25 C myAmt < vD myAmt = myAmt - vD nD = nD + 1 nD = 0; vD=0.10 myAmt < vN myAmt = myAmt - vN nN = nN + 1 nN = 0; vN=0.05 C myAmt < vP myAmt = myAmt - vP nP = nP + 1 nP = 0; vP=0.01 B D

D printf nH,nQ,nD,nN,nP Finish

myAmt < vQ myAmt = myAmt - vQ nQ = nQ + 1 nQ = 0; vQ=0.25 C myAmt < vD myAmt = myAmt - vD nD = nD + 1 nD = 0; vD=0.10 B myAmt < vC myAmt = myAmt - vC nC = nC + 1 nC = 0; vC=input General case: nC=number coinsOutput vC=value of coinInput myAmt=amt leftInput/Output function: change return

myAmt < vC myAmt = myAmt - vC nC = nC + 1 nC = 0; vC=input General case: nC=number coinsOutput vC=value of coinInput myAmt=amt leftInput/Output function:change (addr nC, val vC, addr Amt) return myAmt = amount scanf amount Start change(nH,vH,myAmt) change(nQ,vQ,myAmt) change(nD,vD,myAmt) change(nN,vN,myAmt) change(nP,vP,myAmt) printf nH,nQ,nD,nN,nP Finish

myAmt < vC myAmt = myAmt - vC nC = nC + 1 nC = 0; vC=input General case: nC=number coinsOutput vC=value of coinInput myAmt=amt leftInput/Output function:change (addr nC, val vC, addr Amt) return myAmt = amount scanf amount Start change(nH,vH,myAmt) change(nQ,vQ,myAmt) change(nD,vD,myAmt) change(nN,vN,myAmt) change(nP,vP,myAmt) printf nH,nQ,nD,nN,nP Finish myAmt < 0 myAmt = amount scanf amount